| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 SkGpuDevice_DEFINED | 8 #ifndef SkGpuDevice_DEFINED |
| 9 #define SkGpuDevice_DEFINED | 9 #define SkGpuDevice_DEFINED |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 // set all pixels to 0 | 79 // set all pixels to 0 |
| 80 void clearAll(); | 80 void clearAll(); |
| 81 | 81 |
| 82 void replaceDrawContext(bool shouldRetainContent); | 82 void replaceDrawContext(bool shouldRetainContent); |
| 83 | 83 |
| 84 GrDrawContext* accessDrawContext() override; | 84 GrDrawContext* accessDrawContext() override; |
| 85 | 85 |
| 86 SkImageInfo imageInfo() const override { | 86 SkImageInfo imageInfo() const override { |
| 87 SkColorType colorType; | 87 SkColorType colorType; |
| 88 if (!GrPixelConfigToColorType(fRenderTarget->config(), &colorType)) { | 88 if (!GrPixelConfigToColorType(fDrawContext->config(), &colorType)) { |
| 89 colorType = kUnknown_SkColorType; | 89 colorType = kUnknown_SkColorType; |
| 90 } | 90 } |
| 91 return SkImageInfo::Make(fSize.fWidth, fSize.fHeight, colorType, | 91 return SkImageInfo::Make(fSize.fWidth, fSize.fHeight, colorType, |
| 92 fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlpha
Type, | 92 fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlpha
Type, |
| 93 sk_ref_sp(fDrawContext->getColorSpace())); | 93 sk_ref_sp(fDrawContext->getColorSpace())); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void drawPaint(const SkDraw&, const SkPaint& paint) override; | 96 void drawPaint(const SkDraw&, const SkPaint& paint) override; |
| 97 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun
t, | 97 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun
t, |
| 98 const SkPoint[], const SkPaint& paint) override; | 98 const SkPoint[], const SkPaint& paint) override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 // for debugging purposes only | 152 // for debugging purposes only |
| 153 void drawTexture(GrTexture*, const SkRect& dst, const SkPaint&); | 153 void drawTexture(GrTexture*, const SkRect& dst, const SkPaint&); |
| 154 | 154 |
| 155 protected: | 155 protected: |
| 156 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override; | 156 bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override; |
| 157 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) overri
de; | 157 bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) overri
de; |
| 158 bool onShouldDisableLCD(const SkPaint&) const final; | 158 bool onShouldDisableLCD(const SkPaint&) const final; |
| 159 | 159 |
| 160 private: | 160 private: |
| 161 // We want these unreffed in DrawContext, RenderTarget, GrContext order. | 161 // We want these unreffed in DrawContext, GrContext order. |
| 162 SkAutoTUnref<GrContext> fContext; | 162 SkAutoTUnref<GrContext> fContext; |
| 163 sk_sp<GrRenderTarget> fRenderTarget; | |
| 164 sk_sp<GrDrawContext> fDrawContext; | 163 sk_sp<GrDrawContext> fDrawContext; |
| 165 | 164 |
| 166 SkIPoint fClipOrigin; | 165 SkIPoint fClipOrigin; |
| 167 GrClipStackClip fClip; | 166 GrClipStackClip fClip; |
| 168 SkISize fSize; | 167 SkISize fSize; |
| 169 bool fOpaque; | 168 bool fOpaque; |
| 170 | 169 |
| 171 enum Flags { | 170 enum Flags { |
| 172 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear | 171 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear |
| 173 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this
device will be | 172 kIsOpaque_Flag = 1 << 1, //!< Hint from client that rendering to this
device will be |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 int sampleCount, | 271 int sampleCount, |
| 273 GrSurfaceOrigin, | 272 GrSurfaceOrigin, |
| 274 const SkSurfaceProps*); | 273 const SkSurfaceProps*); |
| 275 | 274 |
| 276 friend class GrAtlasTextContext; | 275 friend class GrAtlasTextContext; |
| 277 friend class SkSurface_Gpu; // for access to surfaceProps | 276 friend class SkSurface_Gpu; // for access to surfaceProps |
| 278 typedef SkBaseDevice INHERITED; | 277 typedef SkBaseDevice INHERITED; |
| 279 }; | 278 }; |
| 280 | 279 |
| 281 #endif | 280 #endif |
| OLD | NEW |