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

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

Issue 583453002: SkCanvas::drawImage is the new way for drawing an SkImage to a Canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@refactor_skImage
Patch Set: Make SkImage::draw public temporary for compatibility reasons Created 6 years, 2 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/core/SkCanvas.cpp ('k') | src/image/SkSurface.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 * 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 "GrRecordReplaceDraw.h" 8 #include "GrRecordReplaceDraw.h"
9 #include "SkImage.h" 9 #include "SkImage.h"
10 #include "SkRecordDraw.h" 10 #include "SkRecordDraw.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 return NULL; 51 return NULL;
52 } 52 }
53 53
54 static inline void draw_replacement_bitmap(const GrReplacements::ReplacementInfo * ri, 54 static inline void draw_replacement_bitmap(const GrReplacements::ReplacementInfo * ri,
55 SkCanvas* canvas, 55 SkCanvas* canvas,
56 const SkMatrix& initialMatrix) { 56 const SkMatrix& initialMatrix) {
57 SkRect src = SkRect::Make(ri->fSrcRect); 57 SkRect src = SkRect::Make(ri->fSrcRect);
58 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(ri->fPos.fX), 58 SkRect dst = SkRect::MakeXYWH(SkIntToScalar(ri->fPos.fX),
59 SkIntToScalar(ri->fPos.fY), 59 SkIntToScalar(ri->fPos.fY),
60 SkIntToScalar(ri->fSrcRect.width()), 60 SkIntToScalar(ri->fSrcRect.width()),
61 SkIntToScalar(ri->fSrcRect.height())); 61 SkIntToScalar(ri->fSrcRect.height()));
62 62
63 canvas->save(); 63 canvas->save();
64 canvas->setMatrix(initialMatrix); 64 canvas->setMatrix(initialMatrix);
65 ri->fImage->draw(canvas, &src, dst, ri->fPaint); 65 canvas->drawImageRect(ri->fImage, &src, dst, ri->fPaint);
66 canvas->restore(); 66 canvas->restore();
67 } 67 }
68 68
69 void GrRecordReplaceDraw(const SkRecord& record, 69 void GrRecordReplaceDraw(const SkRecord& record,
70 SkCanvas* canvas, 70 SkCanvas* canvas,
71 const SkBBoxHierarchy* bbh, 71 const SkBBoxHierarchy* bbh,
72 const GrReplacements* replacements, 72 const GrReplacements* replacements,
73 SkDrawPictureCallback* callback) { 73 SkDrawPictureCallback* callback) {
74 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); 74 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
75 75
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (ri) { 117 if (ri) {
118 draw_replacement_bitmap(ri, canvas, initialMatrix); 118 draw_replacement_bitmap(ri, canvas, initialMatrix);
119 i = ri->fStop; 119 i = ri->fStop;
120 continue; 120 continue;
121 } 121 }
122 122
123 record.visit<void>(i, draw); 123 record.visit<void>(i, draw);
124 } 124 }
125 } 125 }
126 } 126 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/image/SkSurface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698