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

Side by Side Diff: src/image/SkSurface_Base.h

Issue 14063015: Adding optimization to avoid image copy in SkSurface copy on write when content is discardable (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/image/SkSurface.cpp ('k') | src/image/SkSurface_Gpu.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 #ifndef SkSurface_Base_DEFINED 8 #ifndef SkSurface_Base_DEFINED
9 #define SkSurface_Base_DEFINED 9 #define SkSurface_Base_DEFINED
10 10
(...skipping 30 matching lines...) Expand all
41 * image->draw(canvas, ...); 41 * image->draw(canvas, ...);
42 * image->unref(); 42 * image->unref();
43 * } 43 * }
44 */ 44 */
45 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); 45 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*);
46 46
47 /** 47 /**
48 * If the surface is about to change, we call this so that our subclass 48 * If the surface is about to change, we call this so that our subclass
49 * can optionally fork their backend (copy-on-write) in case it was 49 * can optionally fork their backend (copy-on-write) in case it was
50 * being shared with the cachedImage. 50 * being shared with the cachedImage.
51 *
52 * The default implementation does nothing.
53 */ 51 */
54 virtual void onCopyOnWrite() = 0; 52 virtual void onCopyOnWrite(ContentChangeMode) = 0;
55 53
56 inline SkCanvas* getCachedCanvas(); 54 inline SkCanvas* getCachedCanvas();
57 inline SkImage* getCachedImage(); 55 inline SkImage* getCachedImage();
58 56
59 // called by SkSurface to compute a new genID 57 // called by SkSurface to compute a new genID
60 uint32_t newGenerationID(); 58 uint32_t newGenerationID();
61 59
62 private: 60 private:
63 SkCanvas* fCachedCanvas; 61 SkCanvas* fCachedCanvas;
64 SkImage* fCachedImage; 62 SkImage* fCachedImage;
65 63
66 void aboutToDraw(); 64 void aboutToDraw(ContentChangeMode mode);
67 friend class SkCanvas; 65 friend class SkCanvas;
68 friend class SkSurface; 66 friend class SkSurface;
69 67
70 inline void installIntoCanvasForDirtyNotification(); 68 inline void installIntoCanvasForDirtyNotification();
71 69
72 typedef SkSurface INHERITED; 70 typedef SkSurface INHERITED;
73 }; 71 };
74 72
75 #endif 73 #endif
OLDNEW
« no previous file with comments | « src/image/SkSurface.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698