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

Side by Side Diff: src/image/SkSurface.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/gpu/GrRecordReplaceDraw.cpp ('k') | src/utils/SkLua.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 2012 Google Inc. 2 * Copyright 2012 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 "SkSurface_Base.h" 8 #include "SkSurface_Base.h"
9 #include "SkImagePriv.h" 9 #include "SkImagePriv.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 fCachedCanvas->setSurfaceBase(NULL); 69 fCachedCanvas->setSurfaceBase(NULL);
70 } 70 }
71 71
72 SkSafeUnref(fCachedImage); 72 SkSafeUnref(fCachedImage);
73 SkSafeUnref(fCachedCanvas); 73 SkSafeUnref(fCachedCanvas);
74 } 74 }
75 75
76 void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa int* paint) { 76 void SkSurface_Base::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPa int* paint) {
77 SkImage* image = this->newImageSnapshot(); 77 SkImage* image = this->newImageSnapshot();
78 if (image) { 78 if (image) {
79 image->draw(canvas, x, y, paint); 79 canvas->drawImage(image, x, y, paint);
80 image->unref(); 80 image->unref();
81 } 81 }
82 } 82 }
83 83
84 void SkSurface_Base::aboutToDraw(ContentChangeMode mode) { 84 void SkSurface_Base::aboutToDraw(ContentChangeMode mode) {
85 this->dirtyGenerationID(); 85 this->dirtyGenerationID();
86 86
87 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this); 87 SkASSERT(!fCachedCanvas || fCachedCanvas->getSurfaceBase() == this);
88 88
89 if (fCachedImage) { 89 if (fCachedImage) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) { 204 SkSurface* SkSurface::NewRenderTarget(GrContext*, const SkImageInfo&, int, const SkSurfaceProps*) {
205 return NULL; 205 return NULL;
206 } 206 }
207 207
208 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount, 208 SkSurface* SkSurface::NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
209 const SkSurfaceProps*) { 209 const SkSurfaceProps*) {
210 return NULL; 210 return NULL;
211 } 211 }
212 212
213 #endif 213 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrRecordReplaceDraw.cpp ('k') | src/utils/SkLua.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698