Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: src/utils/SkNinePatch.cpp

Issue 1240753003: Revert[2] of guard to remove DrawBitmapRectFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/utils/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkNinePatch.h" 10 #include "SkNinePatch.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 numYDivs -= 1; 129 numYDivs -= 1;
130 } 130 }
131 } 131 }
132 132
133 Mesh mesh; 133 Mesh mesh;
134 134
135 const int numXStretch = (numXDivs + 1) >> 1; 135 const int numXStretch = (numXDivs + 1) >> 1;
136 const int numYStretch = (numYDivs + 1) >> 1; 136 const int numYStretch = (numYDivs + 1) >> 1;
137 137
138 if (numXStretch < 1 && numYStretch < 1) { 138 if (numXStretch < 1 && numYStretch < 1) {
139 canvas->drawBitmapRect(bitmap, NULL, bounds, paint); 139 canvas->drawBitmapRect(bitmap, bounds, paint);
140 return; 140 return;
141 } 141 }
142 142
143 if (false) { 143 if (false) {
144 int i; 144 int i;
145 for (i = 0; i < numXDivs; i++) { 145 for (i = 0; i < numXDivs; i++) {
146 SkDebugf("--- xdivs[%d] %d\n", i, xDivs[i]); 146 SkDebugf("--- xdivs[%d] %d\n", i, xDivs[i]);
147 } 147 }
148 for (i = 0; i < numYDivs; i++) { 148 for (i = 0; i < numYDivs; i++) {
149 SkDebugf("--- ydivs[%d] %d\n", i, yDivs[i]); 149 SkDebugf("--- ydivs[%d] %d\n", i, yDivs[i]);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 for (int y = 0; y < 3; y++) { 286 for (int y = 0; y < 3; y++) {
287 s.fTop = srcY[y]; 287 s.fTop = srcY[y];
288 s.fBottom = srcY[y+1]; 288 s.fBottom = srcY[y+1];
289 d.fTop = dstY[y]; 289 d.fTop = dstY[y];
290 d.fBottom = dstY[y+1]; 290 d.fBottom = dstY[y+1];
291 for (int x = 0; x < 3; x++) { 291 for (int x = 0; x < 3; x++) {
292 s.fLeft = srcX[x]; 292 s.fLeft = srcX[x];
293 s.fRight = srcX[x+1]; 293 s.fRight = srcX[x+1];
294 d.fLeft = dstX[x]; 294 d.fLeft = dstX[x];
295 d.fRight = dstX[x+1]; 295 d.fRight = dstX[x+1];
296 canvas->drawBitmapRect(bitmap, &s, d, paint); 296 canvas->drawBitmapRect(bitmap, s, d, paint);
297 } 297 }
298 } 298 }
299 } 299 }
300 300
301 void SkNinePatch::DrawNine(SkCanvas* canvas, const SkRect& bounds, 301 void SkNinePatch::DrawNine(SkCanvas* canvas, const SkRect& bounds,
302 const SkBitmap& bitmap, const SkIRect& margins, 302 const SkBitmap& bitmap, const SkIRect& margins,
303 const SkPaint* paint) { 303 const SkPaint* paint) {
304 /** Our vertices code has numerical precision problems if the transformed 304 /** Our vertices code has numerical precision problems if the transformed
305 coordinates land directly on a 1/2 pixel boundary. To work around that 305 coordinates land directly on a 1/2 pixel boundary. To work around that
306 for now, we only take the vertices case if we are in opengl. Also, 306 for now, we only take the vertices case if we are in opengl. Also,
(...skipping 19 matching lines...) Expand all
326 (margins.fTop + margins.fBottom); 326 (margins.fTop + margins.fBottom);
327 yDivs[1] = yDivs[0]; 327 yDivs[1] = yDivs[0];
328 } 328 }
329 329
330 SkNinePatch::DrawMesh(canvas, bounds, bitmap, 330 SkNinePatch::DrawMesh(canvas, bounds, bitmap,
331 xDivs, 2, yDivs, 2, paint); 331 xDivs, 2, yDivs, 2, paint);
332 } else { 332 } else {
333 drawNineViaRects(canvas, bounds, bitmap, margins, paint); 333 drawNineViaRects(canvas, bounds, bitmap, margins, paint);
334 } 334 }
335 } 335 }
OLDNEW
« no previous file with comments | « src/gpu/SkGr.cpp ('k') | src/utils/debugger/SkDrawCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698