| 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 | 9 |
| 10 | 10 |
| 11 #ifndef SkGpuDevice_DEFINED | 11 #ifndef SkGpuDevice_DEFINED |
| 12 #define SkGpuDevice_DEFINED | 12 #define SkGpuDevice_DEFINED |
| 13 | 13 |
| 14 #include "SkGr.h" | 14 #include "SkGr.h" |
| 15 #include "SkBitmap.h" | 15 #include "SkBitmap.h" |
| 16 #include "SkBitmapDevice.h" | 16 #include "SkDevice.h" |
| 17 #include "SkPicture.h" | 17 #include "SkPicture.h" |
| 18 #include "SkRegion.h" | 18 #include "SkRegion.h" |
| 19 #include "GrContext.h" | 19 #include "GrContext.h" |
| 20 | 20 |
| 21 struct SkDrawProcs; | 21 struct SkDrawProcs; |
| 22 struct GrSkDrawProcs; | 22 struct GrSkDrawProcs; |
| 23 | 23 |
| 24 class GrTextContext; | 24 class GrTextContext; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Subclass of SkBitmapDevice, which directs all drawing to the GrGpu owned by
the | 27 * Subclass of SkBaseDevice, which directs all drawing to the GrGpu owned by th
e |
| 28 * canvas. | 28 * canvas. |
| 29 */ | 29 */ |
| 30 class SK_API SkGpuDevice : public SkBitmapDevice { | 30 class SK_API SkGpuDevice : public SkBaseDevice { |
| 31 public: | 31 public: |
| 32 enum Flags { | 32 enum Flags { |
| 33 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear | 33 kNeedClear_Flag = 1 << 0, //!< Surface requires an initial clear |
| 34 kCached_Flag = 1 << 1, //!< Surface is cached and needs to be unlock
ed when released | 34 kCached_Flag = 1 << 1, //!< Surface is cached and needs to be unlock
ed when released |
| 35 kDFFonts_Flag = 1 << 2, //!< Surface should render fonts using signed
distance fields | 35 kDFFonts_Flag = 1 << 2, //!< Surface should render fonts using signed
distance fields |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Creates an SkGpuDevice from a GrSurface. This will fail if the surface is
not a render | 39 * Creates an SkGpuDevice from a GrSurface. This will fail if the surface is
not a render |
| 40 * target. The caller owns a ref on the returned device. If the surface is c
ached, | 40 * target. The caller owns a ref on the returned device. If the surface is c
ached, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 GrClipData fClipData; | 155 GrClipData fClipData; |
| 156 | 156 |
| 157 GrTextContext* fMainTextContext; | 157 GrTextContext* fMainTextContext; |
| 158 GrTextContext* fFallbackTextContext; | 158 GrTextContext* fFallbackTextContext; |
| 159 | 159 |
| 160 // state for our render-target | 160 // state for our render-target |
| 161 GrRenderTarget* fRenderTarget; | 161 GrRenderTarget* fRenderTarget; |
| 162 bool fNeedClear; | 162 bool fNeedClear; |
| 163 | 163 |
| 164 // remove when our clients don't rely on accessBitmap() |
| 165 SkBitmap fLegacyBitmap; |
| 166 |
| 164 // called from rt and tex cons | 167 // called from rt and tex cons |
| 165 void initFromRenderTarget(GrContext*, GrRenderTarget*, unsigned flags); | 168 void initFromRenderTarget(GrContext*, GrRenderTarget*, unsigned flags); |
| 166 | 169 |
| 167 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; | 170 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; |
| 168 | 171 |
| 169 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; | 172 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; |
| 170 | 173 |
| 171 // sets the render target, clip, and matrix on GrContext. Use forceIdenity t
o override | 174 // sets the render target, clip, and matrix on GrContext. Use forceIdenity t
o override |
| 172 // SkDraw's matrix and draw in device coords. | 175 // SkDraw's matrix and draw in device coords. |
| 173 void prepareDraw(const SkDraw&, bool forceIdentity); | 176 void prepareDraw(const SkDraw&, bool forceIdentity); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 const GrTextureParams& params, | 210 const GrTextureParams& params, |
| 208 const SkPaint& paint, | 211 const SkPaint& paint, |
| 209 SkCanvas::DrawBitmapRectFlags flags, | 212 SkCanvas::DrawBitmapRectFlags flags, |
| 210 int tileSize, | 213 int tileSize, |
| 211 bool bicubic); | 214 bool bicubic); |
| 212 | 215 |
| 213 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint); | 216 bool drawDashLine(const SkPoint pts[2], const SkPaint& paint); |
| 214 | 217 |
| 215 static SkPicture::AccelData::Key ComputeAccelDataKey(); | 218 static SkPicture::AccelData::Key ComputeAccelDataKey(); |
| 216 | 219 |
| 217 typedef SkBitmapDevice INHERITED; | 220 typedef SkBaseDevice INHERITED; |
| 218 }; | 221 }; |
| 219 | 222 |
| 220 #endif | 223 #endif |
| OLD | NEW |