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

Side by Side Diff: src/gpu/SkGpuDevice.h

Issue 1057693002: Revert of Implement approx-match support in image filter saveLayer() offscreen. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/gpu/SkGpuDevice.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 2010 Google Inc. 3 * Copyright 2010 Google Inc.
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 #ifndef SkGpuDevice_DEFINED 9 #ifndef SkGpuDevice_DEFINED
10 #define SkGpuDevice_DEFINED 10 #define SkGpuDevice_DEFINED
(...skipping 23 matching lines...) Expand all
34 enum Flags { 34 enum Flags {
35 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear 35 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear
36 }; 36 };
37 37
38 /** 38 /**
39 * Creates an SkGpuDevice from a GrRenderTarget. 39 * Creates an SkGpuDevice from a GrRenderTarget.
40 */ 40 */
41 static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, un signed flags = 0); 41 static SkGpuDevice* Create(GrRenderTarget* target, const SkSurfaceProps*, un signed flags = 0);
42 42
43 /** 43 /**
44 * Creates an SkGpuDevice from a GrRenderTarget whose texture width/height i s
45 * different than its actual width/height (e.g., approx-match scratch textur e).
46 */
47 static SkGpuDevice* Create(GrRenderTarget* target, int width, int height,
48 const SkSurfaceProps*, unsigned flags = 0);
49
50 /**
51 * New device that will create an offscreen renderTarget based on the ImageI nfo and 44 * New device that will create an offscreen renderTarget based on the ImageI nfo and
52 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against 45 * sampleCount. The Budgeted param controls whether the device's backing sto re counts against
53 * the resource cache budget. On failure, returns NULL. 46 * the resource cache budget. On failure, returns NULL.
54 */ 47 */
55 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&, 48 static SkGpuDevice* Create(GrContext*, SkSurface::Budgeted, const SkImageInf o&,
56 int sampleCount, const SkSurfaceProps*, unsigned flags = 0); 49 int sampleCount, const SkSurfaceProps*, unsigned flags = 0);
57 50
58 virtual ~SkGpuDevice(); 51 virtual ~SkGpuDevice();
59 52
60 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) { 53 SkGpuDevice* cloneDevice(const SkSurfaceProps& props) {
61 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage, 54 SkBaseDevice* dev = this->onCreateDevice(CreateInfo(this->imageInfo(), k Possible_TileUsage,
62 props.pixelGeometry( )), 55 props.pixelGeometry( )),
63 NULL); 56 NULL);
64 return static_cast<SkGpuDevice*>(dev); 57 return static_cast<SkGpuDevice*>(dev);
65 } 58 }
66 59
67 GrContext* context() const { return fContext; } 60 GrContext* context() const { return fContext; }
68 61
69 // set all pixels to 0 62 // set all pixels to 0
70 void clearAll(); 63 void clearAll();
71 64
72 void replaceRenderTarget(bool shouldRetainContent); 65 void replaceRenderTarget(bool shouldRetainContent);
73 66
74 GrRenderTarget* accessRenderTarget() override; 67 GrRenderTarget* accessRenderTarget() override;
75 68
76 SkImageInfo imageInfo() const override { 69 SkImageInfo imageInfo() const override {
77 return fLegacyBitmap.info(); 70 return fRenderTarget ? fRenderTarget->surfacePriv().info() : SkImageInfo ::MakeUnknown();
78 } 71 }
79 72
80 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } 73 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
81 74
82 void drawPaint(const SkDraw&, const SkPaint& paint) override; 75 void drawPaint(const SkDraw&, const SkPaint& paint) override;
83 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun t, 76 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun t,
84 const SkPoint[], const SkPaint& paint) override; 77 const SkPoint[], const SkPaint& paint) override;
85 virtual void drawRect(const SkDraw&, const SkRect& r, 78 virtual void drawRect(const SkDraw&, const SkRect& r,
86 const SkPaint& paint) override; 79 const SkPaint& paint) override;
87 virtual void drawRRect(const SkDraw&, const SkRRect& r, 80 virtual void drawRRect(const SkDraw&, const SkRRect& r,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void onAttachToCanvas(SkCanvas* canvas) override; 114 void onAttachToCanvas(SkCanvas* canvas) override;
122 void onDetachFromCanvas() override; 115 void onDetachFromCanvas() override;
123 116
124 const SkBitmap& onAccessBitmap() override; 117 const SkBitmap& onAccessBitmap() override;
125 118
126 bool canHandleImageFilter(const SkImageFilter*) override; 119 bool canHandleImageFilter(const SkImageFilter*) override;
127 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, 120 virtual bool filterImage(const SkImageFilter*, const SkBitmap&,
128 const SkImageFilter::Context&, 121 const SkImageFilter::Context&,
129 SkBitmap*, SkIPoint*) override; 122 SkBitmap*, SkIPoint*) override;
130 123
131 bool filterTexture(GrContext*, GrTexture*, int width, int height, const SkIm ageFilter*, 124 bool filterTexture(GrContext*, GrTexture*, const SkImageFilter*,
132 const SkImageFilter::Context&, 125 const SkImageFilter::Context&,
133 SkBitmap* result, SkIPoint* offset); 126 SkBitmap* result, SkIPoint* offset);
134 127
135 protected: 128 protected:
136 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override; 129 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override;
137 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) overri de; 130 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) overri de;
138 bool onShouldDisableLCD(const SkPaint&) const override; 131 bool onShouldDisableLCD(const SkPaint&) const override;
139 132
140 /** PRIVATE / EXPERIMENTAL -- do not call */ 133 /** PRIVATE / EXPERIMENTAL -- do not call */
141 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic ture, 134 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic ture,
142 const SkMatrix*, const SkPaint*) overr ide; 135 const SkMatrix*, const SkPaint*) overr ide;
143 136
144 private: 137 private:
145 GrContext* fContext; 138 GrContext* fContext;
146 GrSkDrawProcs* fDrawProcs; 139 GrSkDrawProcs* fDrawProcs;
147 SkAutoTUnref<const SkClipStack> fClipStack; 140 SkAutoTUnref<const SkClipStack> fClipStack;
148 SkIPoint fClipOrigin; 141 SkIPoint fClipOrigin;
149 GrClip fClip; 142 GrClip fClip;
150 GrTextContext* fTextContext; 143 GrTextContext* fTextContext;
151 SkSurfaceProps fSurfaceProps; 144 SkSurfaceProps fSurfaceProps;
152 GrRenderTarget* fRenderTarget; 145 GrRenderTarget* fRenderTarget;
153 // remove when our clients don't rely on accessBitmap() 146 // remove when our clients don't rely on accessBitmap()
154 SkBitmap fLegacyBitmap; 147 SkBitmap fLegacyBitmap;
155 bool fNeedClear; 148 bool fNeedClear;
156 149
157 SkGpuDevice(GrRenderTarget*, int width, int height, const SkSurfaceProps*, u nsigned flags); 150 SkGpuDevice(GrRenderTarget*, const SkSurfaceProps*, unsigned flags);
158 151
159 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; 152 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
160 153
161 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; 154 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override;
162 155
163 SkImageFilter::Cache* getImageFilterCache() override; 156 SkImageFilter::Cache* getImageFilterCache() override;
164 157
165 bool forceConservativeRasterClip() const override { return true; } 158 bool forceConservativeRasterClip() const override { return true; }
166 159
167 // sets the render target and clip on context 160 // sets the render target and clip on context
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 211
219 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&, 212 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c onst SkImageInfo&,
220 int sampleCount); 213 int sampleCount);
221 214
222 friend class GrBitmapTextContextB; 215 friend class GrBitmapTextContextB;
223 friend class GrTextContext; 216 friend class GrTextContext;
224 typedef SkBaseDevice INHERITED; 217 typedef SkBaseDevice INHERITED;
225 }; 218 };
226 219
227 #endif 220 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698