diff options
author | Cary Clark <caryclark@skia.org> | 2018-03-22 07:58:54 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-22 12:27:54 +0000 |
commit | edd0895d9cc402d9d6ae7ca72362ef7b5ee44039 (patch) | |
tree | e5cc1d5ae82e703da205545ce13190d854b8dc36 /site | |
parent | 99af95a80df5eb59446646720e9dc62a0a799c22 (diff) |
update SkIRect centerx centery docs
R=caryclark@google.com
Docs-Preview: https://skia.org/?cl=115820
Bug: skia:6898
Change-Id: I1d3c32d40ed4000f060a535cbcd20b39d0ff9fc3
Reviewed-on: https://skia-review.googlesource.com/115820
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'site')
-rw-r--r-- | site/user/api/SkIRect_Reference.md | 8 | ||||
-rw-r--r-- | site/user/api/catalog.htm | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/site/user/api/SkIRect_Reference.md b/site/user/api/SkIRect_Reference.md index 049c2b6da1..47d2b8eb4f 100644 --- a/site/user/api/SkIRect_Reference.md +++ b/site/user/api/SkIRect_Reference.md @@ -723,7 +723,7 @@ int32_t centerX() const </pre> Returns average of left edge and right edge. Result does not change if <a href="#IRect">IRect</a> -is sorted. Result may be incorrect if <a href="#IRect">IRect</a> is far from the origin. +is sorted. Result is rounded down. @@ -760,7 +760,7 @@ int32_t centerY() const </pre> Returns average of top edge and bottom edge. Result does not change if <a href="#IRect">IRect</a> -is sorted. Result may be incorrect if <a href="#IRect">IRect</a> is far from the origin. +is sorted. Result is rounded down. @@ -770,12 +770,12 @@ midpoint in y ### Example -<div><fiddle-embed name="687d833b042fb018f8948764e73a37b1"> +<div><fiddle-embed name="6449f7156330efbb3f344c0b787330a5"> #### Example Output ~~~~ -left: 1073741824 right: 1073741826 centerX: 1073741825 safe mid x: 1073741825 +left: 1073741824 right: 1073741826 centerX: 1073741825 ~~~~ </fiddle-embed></div> diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm index 879b114c4d..37741eef05 100644 --- a/site/user/api/catalog.htm +++ b/site/user/api/catalog.htm @@ -736,11 +736,11 @@ "stdout": "left: 20 right: 41 centerX: 30 div2: 30\\nleft: -20 right: -41 centerX: -31 div2: -30\\nleft: -10 right: 11 centerX: 0 div2: 0\\n" }, "SkIRect_centerY": { - "code": "void draw(SkCanvas* canvas) {\n SkIRect rect = { 0, 0, 2, 2 };\n rect.offset(0x40000000, 0x40000000);\n SkDebugf(\"left: %d right: %d centerX: %d \", rect.left(), rect.right(), rect.centerX());\n SkDebugf(\"safe mid x: %d\\n\", rect.left() / 2 + rect.right() / 2);\n}", - "hash": "687d833b042fb018f8948764e73a37b1", + "code": "void draw(SkCanvas* canvas) {\n SkIRect rect = { 0, 0, 2, 2 };\n rect.offset(0x40000000, 0x40000000);\n SkDebugf(\"left: %d right: %d centerX: %d \", rect.left(), rect.right(), rect.centerX());\n}", + "hash": "6449f7156330efbb3f344c0b787330a5", "file": "SkIRect_Reference", "name": "SkIRect::centerY", - "stdout": "left: 1073741824 right: 1073741826 centerX: 1073741825 safe mid x: 1073741825\\n" + "stdout": "left: 1073741824 right: 1073741826 centerX: 1073741825" }, "SkIRect_contains": { "code": "void draw(SkCanvas* canvas) {\n SkIRect rect = { 30, 50, 40, 60 };\n SkIPoint pts[] = { { 30, 50}, { 40, 50}, { 30, 60} };\n for (auto pt : pts) {\n SkDebugf(\"rect: (%d, %d, %d, %d) %s (%d, %d)\\n\",\n rect.left(), rect.top(), rect.right(), rect.bottom(),\n rect.contains(pt.x(), pt.y()) ? \"contains\" : \"does not contain\", pt.x(), pt.y());\n }\n}", @@ -5102,13 +5102,13 @@ "file": "SkImage_Reference", "name": "SkImage::MakeCrossContextFromPixmap" }, - "SkImage_MakeFromAdoptedTexture_2": { + "SkImage_MakeFromAdoptedTexture": { "code": "void draw(SkCanvas* canvas) {\n if (!canvas->getGrContext()) {\n return;\n }\n canvas->scale(.5f, .5f);\n canvas->clear(0x7f3f5f7f);\n int x = 0, y = 0;\n for (auto origin : { kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin } ) {\n for (auto alpha : { kOpaque_SkAlphaType, kPremul_SkAlphaType, kUnpremul_SkAlphaType } ) {\n sk_sp<SkImage> image = SkImage::MakeFromAdoptedTexture(canvas->getGrContext(),\n backEndTexture, origin, \n kRGBA_8888_SkColorType, alpha);\n canvas->drawImage(image, x, y);\n x += 160;\n }\n x -= 160 * 3;\n y += 256;\n }\n}", "width": 256, "height": 256, "hash": "b07964ec9c5c8a6febba805f1cf4d071", "file": "SkImage_Reference", - "name": "SkImage::MakeFromAdoptedTexture_2" + "name": "SkImage::MakeFromAdoptedTexture" }, "SkImage_MakeFromBitmap": { "code": "void draw(SkCanvas* canvas) {\n uint8_t storage[][5] = {{ 0xCA, 0xDA, 0xCA, 0xC9, 0xA3 },\n { 0xAC, 0xA8, 0x89, 0xA7, 0x87 },\n { 0x9B, 0xB5, 0xE5, 0x95, 0x46 },\n { 0x90, 0x81, 0xC5, 0x71, 0x33 },\n { 0x75, 0x55, 0x44, 0x40, 0x30 }};\n SkImageInfo imageInfo = SkImageInfo::Make(5, 5, kGray_8_SkColorType, kOpaque_SkAlphaType);\n SkPixmap pixmap(imageInfo, storage[0], sizeof(storage) / 5);\n SkBitmap bitmap;\n bitmap.installPixels(pixmap);\n sk_sp<SkImage> image1 = SkImage::MakeFromBitmap(bitmap);\n bitmap.setImmutable();\n sk_sp<SkImage> image2 = SkImage::MakeFromBitmap(bitmap);\n *pixmap.writable_addr8(2, 2) = 0x00;\n canvas->scale(10, 10);\n canvas->drawImage(image1, 0, 0);\n canvas->drawImage(image2, 10, 0);\n}", |