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

Side by Side Diff: src/gpu/GrRecordReplaceDraw.cpp

Issue 1228083004: add src-rect-constraint to drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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/effects/SkBitmapSource.cpp ('k') | src/gpu/SkGpuDevice.h » ('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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrContext.h" 8 #include "GrContext.h"
9 #include "GrLayerCache.h" 9 #include "GrLayerCache.h"
10 #include "GrRecordReplaceDraw.h" 10 #include "GrRecordReplaceDraw.h"
(...skipping 25 matching lines...) Expand all
36 &bm); 36 &bm);
37 37
38 if (layer->isAtlased()) { 38 if (layer->isAtlased()) {
39 const SkRect src = SkRect::Make(layer->rect()); 39 const SkRect src = SkRect::Make(layer->rect());
40 const SkRect dst = SkRect::Make(layer->srcIR()); 40 const SkRect dst = SkRect::Make(layer->srcIR());
41 41
42 SkASSERT(layer->offset().isZero()); 42 SkASSERT(layer->offset().isZero());
43 43
44 canvas->save(); 44 canvas->save();
45 canvas->setMatrix(SkMatrix::I()); 45 canvas->setMatrix(SkMatrix::I());
46 canvas->drawBitmapRectToRect(bm, &src, dst, layer->paint()); 46 canvas->drawBitmapRect(bm, &src, dst, layer->paint(), SkCanvas::kStrict_ SrcRectConstraint);
47 canvas->restore(); 47 canvas->restore();
48 } else { 48 } else {
49 canvas->drawSprite(bm, 49 canvas->drawSprite(bm,
50 layer->srcIR().fLeft + layer->offset().fX, 50 layer->srcIR().fLeft + layer->offset().fX,
51 layer->srcIR().fTop + layer->offset().fY, 51 layer->srcIR().fTop + layer->offset().fY,
52 layer->paint()); 52 layer->paint());
53 } 53 }
54 } 54 }
55 55
56 // Used by GrRecordReplaceDraw. It intercepts nested drawPicture calls and 56 // Used by GrRecordReplaceDraw. It intercepts nested drawPicture calls and
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 ReplaceDraw draw(canvas, layerCache, NULL, 0, 221 ReplaceDraw draw(canvas, layerCache, NULL, 0,
222 bp, bp, 222 bp, bp,
223 initialMatrix, callback, NULL, 0); 223 initialMatrix, callback, NULL, 0);
224 return draw.draw(); 224 return draw.draw();
225 } else { 225 } else {
226 // TODO: can we assume / assert this doesn't happen? 226 // TODO: can we assume / assert this doesn't happen?
227 picture->playback(canvas, callback); 227 picture->playback(canvas, callback);
228 return 0; 228 return 0;
229 } 229 }
230 } 230 }
OLDNEW
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/gpu/SkGpuDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698