OLD | NEW |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return static_cast<SkGpuDevice*>(dev); | 57 return static_cast<SkGpuDevice*>(dev); |
58 } | 58 } |
59 | 59 |
60 GrContext* context() const { return fContext; } | 60 GrContext* context() const { return fContext; } |
61 | 61 |
62 // set all pixels to 0 | 62 // set all pixels to 0 |
63 void clearAll(); | 63 void clearAll(); |
64 | 64 |
65 void replaceRenderTarget(bool shouldRetainContent); | 65 void replaceRenderTarget(bool shouldRetainContent); |
66 | 66 |
67 GrRenderTarget* accessRenderTarget() SK_OVERRIDE; | 67 GrRenderTarget* accessRenderTarget() override; |
68 | 68 |
69 SkImageInfo imageInfo() const SK_OVERRIDE { | 69 SkImageInfo imageInfo() const override { |
70 return fRenderTarget ? fRenderTarget->surfacePriv().info() : SkImageInfo
::MakeUnknown(); | 70 return fRenderTarget ? fRenderTarget->surfacePriv().info() : SkImageInfo
::MakeUnknown(); |
71 } | 71 } |
72 | 72 |
73 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } | 73 const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; } |
74 | 74 |
75 void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE; | 75 void drawPaint(const SkDraw&, const SkPaint& paint) override; |
76 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, |
77 const SkPoint[], const SkPaint& paint) SK_OVERRIDE; | 77 const SkPoint[], const SkPaint& paint) override; |
78 virtual void drawRect(const SkDraw&, const SkRect& r, | 78 virtual void drawRect(const SkDraw&, const SkRect& r, |
79 const SkPaint& paint) SK_OVERRIDE; | 79 const SkPaint& paint) override; |
80 virtual void drawRRect(const SkDraw&, const SkRRect& r, | 80 virtual void drawRRect(const SkDraw&, const SkRRect& r, |
81 const SkPaint& paint) SK_OVERRIDE; | 81 const SkPaint& paint) override; |
82 virtual void drawDRRect(const SkDraw& draw, const SkRRect& outer, | 82 virtual void drawDRRect(const SkDraw& draw, const SkRRect& outer, |
83 const SkRRect& inner, const SkPaint& paint) SK_OVERR
IDE; | 83 const SkRRect& inner, const SkPaint& paint) override
; |
84 virtual void drawOval(const SkDraw&, const SkRect& oval, | 84 virtual void drawOval(const SkDraw&, const SkRect& oval, |
85 const SkPaint& paint) SK_OVERRIDE; | 85 const SkPaint& paint) override; |
86 virtual void drawPath(const SkDraw&, const SkPath& path, | 86 virtual void drawPath(const SkDraw&, const SkPath& path, |
87 const SkPaint& paint, const SkMatrix* prePathMatrix, | 87 const SkPaint& paint, const SkMatrix* prePathMatrix, |
88 bool pathIsMutable) SK_OVERRIDE; | 88 bool pathIsMutable) override; |
89 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, | 89 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap, |
90 const SkMatrix&, const SkPaint&) SK_OVERRIDE; | 90 const SkMatrix&, const SkPaint&) override; |
91 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, | 91 virtual void drawBitmapRect(const SkDraw&, const SkBitmap&, |
92 const SkRect* srcOrNull, const SkRect& dst, | 92 const SkRect* srcOrNull, const SkRect& dst, |
93 const SkPaint& paint, | 93 const SkPaint& paint, |
94 SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE
; | 94 SkCanvas::DrawBitmapRectFlags flags) override; |
95 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, | 95 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, |
96 int x, int y, const SkPaint& paint) SK_OVERRIDE; | 96 int x, int y, const SkPaint& paint) override; |
97 virtual void drawText(const SkDraw&, const void* text, size_t len, | 97 virtual void drawText(const SkDraw&, const void* text, size_t len, |
98 SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; | 98 SkScalar x, SkScalar y, const SkPaint&) override; |
99 virtual void drawPosText(const SkDraw&, const void* text, size_t len, | 99 virtual void drawPosText(const SkDraw&, const void* text, size_t len, |
100 const SkScalar pos[], int scalarsPerPos, | 100 const SkScalar pos[], int scalarsPerPos, |
101 const SkPoint& offset, const SkPaint&) SK_OVERRIDE; | 101 const SkPoint& offset, const SkPaint&) override; |
102 virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkSc
alar y, | 102 virtual void drawTextBlob(const SkDraw&, const SkTextBlob*, SkScalar x, SkSc
alar y, |
103 const SkPaint& paint, SkDrawFilter* drawFilter) SK
_OVERRIDE; | 103 const SkPaint& paint, SkDrawFilter* drawFilter) ov
erride; |
104 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou
nt, | 104 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCou
nt, |
105 const SkPoint verts[], const SkPoint texs[], | 105 const SkPoint verts[], const SkPoint texs[], |
106 const SkColor colors[], SkXfermode* xmode, | 106 const SkColor colors[], SkXfermode* xmode, |
107 const uint16_t indices[], int indexCount, | 107 const uint16_t indices[], int indexCount, |
108 const SkPaint&) SK_OVERRIDE; | 108 const SkPaint&) override; |
109 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 109 virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, |
110 const SkPaint&) SK_OVERRIDE; | 110 const SkPaint&) override; |
111 | 111 |
112 void flush() SK_OVERRIDE; | 112 void flush() override; |
113 | 113 |
114 void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE; | 114 void onAttachToCanvas(SkCanvas* canvas) override; |
115 void onDetachFromCanvas() SK_OVERRIDE; | 115 void onDetachFromCanvas() override; |
116 | 116 |
117 const SkBitmap& onAccessBitmap() SK_OVERRIDE; | 117 const SkBitmap& onAccessBitmap() override; |
118 | 118 |
119 bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE; | 119 bool canHandleImageFilter(const SkImageFilter*) override; |
120 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, | 120 virtual bool filterImage(const SkImageFilter*, const SkBitmap&, |
121 const SkImageFilter::Context&, | 121 const SkImageFilter::Context&, |
122 SkBitmap*, SkIPoint*) SK_OVERRIDE; | 122 SkBitmap*, SkIPoint*) override; |
123 | 123 |
124 bool filterTexture(GrContext*, GrTexture*, const SkImageFilter*, | 124 bool filterTexture(GrContext*, GrTexture*, const SkImageFilter*, |
125 const SkImageFilter::Context&, | 125 const SkImageFilter::Context&, |
126 SkBitmap* result, SkIPoint* offset); | 126 SkBitmap* result, SkIPoint* offset); |
127 | 127 |
128 protected: | 128 protected: |
129 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) SK_OVERRIDE; | 129 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override; |
130 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) SK_OVE
RRIDE; | 130 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) overri
de; |
131 bool onShouldDisableLCD(const SkPaint&) const SK_OVERRIDE; | 131 bool onShouldDisableLCD(const SkPaint&) const override; |
132 | 132 |
133 /** PRIVATE / EXPERIMENTAL -- do not call */ | 133 /** PRIVATE / EXPERIMENTAL -- do not call */ |
134 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic
ture, | 134 virtual bool EXPERIMENTAL_drawPicture(SkCanvas* canvas, const SkPicture* pic
ture, |
135 const SkMatrix*, const SkPaint*) SK_OV
ERRIDE; | 135 const SkMatrix*, const SkPaint*) overr
ide; |
136 | 136 |
137 private: | 137 private: |
138 GrContext* fContext; | 138 GrContext* fContext; |
139 GrSkDrawProcs* fDrawProcs; | 139 GrSkDrawProcs* fDrawProcs; |
140 SkAutoTUnref<const SkClipStack> fClipStack; | 140 SkAutoTUnref<const SkClipStack> fClipStack; |
141 SkIPoint fClipOrigin; | 141 SkIPoint fClipOrigin; |
142 GrClip fClip; | 142 GrClip fClip; |
143 GrTextContext* fTextContext; | 143 GrTextContext* fTextContext; |
144 SkSurfaceProps fSurfaceProps; | 144 SkSurfaceProps fSurfaceProps; |
145 GrRenderTarget* fRenderTarget; | 145 GrRenderTarget* fRenderTarget; |
146 // remove when our clients don't rely on accessBitmap() | 146 // remove when our clients don't rely on accessBitmap() |
147 SkBitmap fLegacyBitmap; | 147 SkBitmap fLegacyBitmap; |
148 bool fNeedClear; | 148 bool fNeedClear; |
149 | 149 |
150 SkGpuDevice(GrRenderTarget*, const SkSurfaceProps*, unsigned flags); | 150 SkGpuDevice(GrRenderTarget*, const SkSurfaceProps*, unsigned flags); |
151 | 151 |
152 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) SK_OVERRIDE; | 152 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; |
153 | 153 |
154 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) SK_OVERRIDE
; | 154 SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override; |
155 | 155 |
156 SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; | 156 SkImageFilter::Cache* getImageFilterCache() override; |
157 | 157 |
158 bool forceConservativeRasterClip() const SK_OVERRIDE { return true; } | 158 bool forceConservativeRasterClip() const override { return true; } |
159 | 159 |
160 // sets the render target and clip on context | 160 // sets the render target and clip on context |
161 void prepareDraw(const SkDraw&); | 161 void prepareDraw(const SkDraw&); |
162 | 162 |
163 /** | 163 /** |
164 * Implementation for both drawBitmap and drawBitmapRect. | 164 * Implementation for both drawBitmap and drawBitmapRect. |
165 */ | 165 */ |
166 void drawBitmapCommon(const SkDraw&, | 166 void drawBitmapCommon(const SkDraw&, |
167 const SkBitmap& bitmap, | 167 const SkBitmap& bitmap, |
168 const SkRect* srcRectPtr, | 168 const SkRect* srcRectPtr, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 static SkPicture::AccelData::Key ComputeAccelDataKey(); | 210 static SkPicture::AccelData::Key ComputeAccelDataKey(); |
211 | 211 |
212 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, | 212 static GrRenderTarget* CreateRenderTarget(GrContext*, SkSurface::Budgeted, c
onst SkImageInfo&, |
213 int sampleCount); | 213 int sampleCount); |
214 | 214 |
215 friend class GrTextContext; | 215 friend class GrTextContext; |
216 typedef SkBaseDevice INHERITED; | 216 typedef SkBaseDevice INHERITED; |
217 }; | 217 }; |
218 | 218 |
219 #endif | 219 #endif |
OLD | NEW |