mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 19:12:40 +08:00
Merge branch 'new-renderer' of git://github.com/cocos-creator/cocos2d-x-lite into runtime
# Conflicts: # cocos/platform/mac/CCCanvasRenderingContext2D-mac.mm # cocos/scripting/js-bindings/manual/jsb_gfx_manual.cpp
This commit is contained in:
@@ -178,7 +178,7 @@ namespace {
|
||||
|
||||
-(NSPoint) convertDrawPoint:(NSPoint) point text:(NSString*) text {
|
||||
NSSize textSize = [self measureText:text];
|
||||
NSLog(@"textSize: %f, %f", textSize.width, textSize.height);
|
||||
// NSLog(@"textSize: %f, %f", textSize.width, textSize.height);
|
||||
|
||||
if (_textAlign == CanvasTextAlign::CENTER)
|
||||
{
|
||||
@@ -277,7 +277,7 @@ namespace {
|
||||
return;
|
||||
//TODO:
|
||||
assert(rect.origin.x == 0 && rect.origin.y == 0);
|
||||
NSLog(@"clearRect, image:%f, %f", _image.size.width, _image.size.height);
|
||||
// NSLog(@"clearRect, image:%f, %f", _image.size.width, _image.size.height);
|
||||
assert(rect.size.width <= _image.size.width && rect.size.height <= _image.size.height);
|
||||
|
||||
[_image lockFocus];
|
||||
@@ -329,7 +329,7 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(float width, float height)
|
||||
: __width(width)
|
||||
, __height(height)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D constructor: %p, width: %f, height: %f\n", this, width, height);
|
||||
SE_LOGD("CanvasGradient constructor: %p, width: %f, height: %f\n", this, width, height);
|
||||
_impl = [[CanvasRenderingContext2DImpl alloc] init];
|
||||
[_impl recreateBufferWithWidth:width height:height];
|
||||
}
|
||||
@@ -348,7 +348,7 @@ void CanvasRenderingContext2D::recreateBuffer()
|
||||
|
||||
void CanvasRenderingContext2D::clearRect(float x, float y, float width, float height)
|
||||
{
|
||||
SE_LOGD("CanvasGradient::clearRect: %p, %f, %f, %f, %f\n", this, x, y, width, height);
|
||||
// SE_LOGD("CanvasGradient::clearRect: %p, %f, %f, %f, %f\n", this, x, y, width, height);
|
||||
[_impl clearRect:CGRectMake(x, y, width, height)];
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ void CanvasRenderingContext2D::fillRect(float x, float y, float width, float hei
|
||||
|
||||
void CanvasRenderingContext2D::fillText(const std::string& text, float x, float y, float maxWidth)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D::fillText: %s, %f, %f, %f\n", text.c_str(), x, y, maxWidth);
|
||||
// SE_LOGD("CanvasRenderingContext2D::fillText: %s, %f, %f, %f\n", text.c_str(), x, y, maxWidth);
|
||||
if (text.empty())
|
||||
return;
|
||||
if (_isBufferSizeDirty)
|
||||
@@ -377,7 +377,7 @@ void CanvasRenderingContext2D::fillText(const std::string& text, float x, float
|
||||
|
||||
void CanvasRenderingContext2D::strokeText(const std::string& text, float x, float y, float maxWidth)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D::strokeText: %s, %f, %f, %f\n", text.c_str(), x, y, maxWidth);
|
||||
// SE_LOGD("CanvasRenderingContext2D::strokeText: %s, %f, %f, %f\n", text.c_str(), x, y, maxWidth);
|
||||
if (text.empty())
|
||||
return;
|
||||
if (_isBufferSizeDirty)
|
||||
@@ -389,7 +389,7 @@ void CanvasRenderingContext2D::strokeText(const std::string& text, float x, floa
|
||||
|
||||
cocos2d::Size CanvasRenderingContext2D::measureText(const std::string& text)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D::measureText: %s\n", text.c_str());
|
||||
// SE_LOGD("CanvasRenderingContext2D::measureText: %s\n", text.c_str());
|
||||
CGSize size = [_impl measureText: [NSString stringWithUTF8String:text.c_str()]];
|
||||
return cocos2d::Size(size.width, size.height);
|
||||
}
|
||||
@@ -441,7 +441,7 @@ void CanvasRenderingContext2D::setCanvasBufferUpdatedCallback(const CanvasBuffer
|
||||
|
||||
void CanvasRenderingContext2D::set__width(float width)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D::set__width: %f\n", width);
|
||||
// SE_LOGD("CanvasRenderingContext2D::set__width: %f\n", width);
|
||||
__width = width;
|
||||
_isBufferSizeDirty = true;
|
||||
recreateBuffer();
|
||||
@@ -449,7 +449,7 @@ void CanvasRenderingContext2D::set__width(float width)
|
||||
|
||||
void CanvasRenderingContext2D::set__height(float height)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D::set__height: %f\n", height);
|
||||
// SE_LOGD("CanvasRenderingContext2D::set__height: %f\n", height);
|
||||
__height = height;
|
||||
_isBufferSizeDirty = true;
|
||||
recreateBuffer();
|
||||
@@ -492,7 +492,7 @@ void CanvasRenderingContext2D::set_font(const std::string& font)
|
||||
|
||||
void CanvasRenderingContext2D::set_textAlign(const std::string& textAlign)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D::set_textAlign: %s\n", textAlign.c_str());
|
||||
// SE_LOGD("CanvasRenderingContext2D::set_textAlign: %s\n", textAlign.c_str());
|
||||
if (textAlign == "left")
|
||||
{
|
||||
_impl.textAlign = CanvasTextAlign::LEFT;
|
||||
@@ -513,7 +513,7 @@ void CanvasRenderingContext2D::set_textAlign(const std::string& textAlign)
|
||||
|
||||
void CanvasRenderingContext2D::set_textBaseline(const std::string& textBaseline)
|
||||
{
|
||||
SE_LOGD("CanvasRenderingContext2D::set_textBaseline: %s\n", textBaseline.c_str());
|
||||
// SE_LOGD("CanvasRenderingContext2D::set_textBaseline: %s\n", textBaseline.c_str());
|
||||
if (textBaseline == "top")
|
||||
{
|
||||
_impl.textBaseLine = CanvasTextBaseline::TOP;
|
||||
@@ -536,7 +536,7 @@ void CanvasRenderingContext2D::set_fillStyle(const std::string& fillStyle)
|
||||
{
|
||||
CSSColorParser::Color color = CSSColorParser::parse(fillStyle);
|
||||
[_impl setFillStyleWithRed:color.r/255.0f green:color.g/255.0f blue:color.b/255.0f alpha:color.a];
|
||||
SE_LOGD("CanvasRenderingContext2D::set_fillStyle: %s, (%d, %d, %d, %f)\n", fillStyle.c_str(), color.r, color.g, color.b, color.a);
|
||||
// SE_LOGD("CanvasRenderingContext2D::set_fillStyle: %s, (%d, %d, %d, %f)\n", fillStyle.c_str(), color.r, color.g, color.b, color.a);
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::set_strokeStyle(const std::string& strokeStyle)
|
||||
|
||||
Reference in New Issue
Block a user