| 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 |
| 11 #include "SkGr.h" | 11 #include "SkGr.h" |
| 12 #include "SkGrPriv.h" |
| 12 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
| 13 #include "SkDevice.h" | 14 #include "SkDevice.h" |
| 14 #include "SkPicture.h" | 15 #include "SkPicture.h" |
| 15 #include "SkRegion.h" | 16 #include "SkRegion.h" |
| 16 #include "SkSurface.h" | 17 #include "SkSurface.h" |
| 17 #include "GrDrawContext.h" | 18 #include "GrDrawContext.h" |
| 18 #include "GrContext.h" | 19 #include "GrContext.h" |
| 19 #include "GrSurfacePriv.h" | 20 #include "GrSurfacePriv.h" |
| 20 #include "GrTypes.h" | 21 #include "GrTypes.h" |
| 21 | 22 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 GrContext* context() const override { return fContext; } | 76 GrContext* context() const override { return fContext; } |
| 76 | 77 |
| 77 // set all pixels to 0 | 78 // set all pixels to 0 |
| 78 void clearAll(); | 79 void clearAll(); |
| 79 | 80 |
| 80 void replaceDrawContext(bool shouldRetainContent); | 81 void replaceDrawContext(bool shouldRetainContent); |
| 81 | 82 |
| 82 GrDrawContext* accessDrawContext() override; | 83 GrDrawContext* accessDrawContext() override; |
| 83 | 84 |
| 84 SkImageInfo imageInfo() const override { | 85 SkImageInfo imageInfo() const override { |
| 85 SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; | 86 SkColorType colorType; |
| 86 SkImageInfo info = fRenderTarget->surfacePriv().info(at).makeWH(fSize.fW
idth, | 87 if (!GrPixelConfigToColorType(fRenderTarget->config(), &colorType)) { |
| 87 fSize.fH
eight); | 88 colorType = kUnknown_SkColorType; |
| 88 return info; | 89 } |
| 90 return SkImageInfo::Make(fSize.fWidth, fSize.fHeight, colorType, |
| 91 fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlpha
Type, |
| 92 sk_ref_sp(fDrawContext->getColorSpace())); |
| 89 } | 93 } |
| 90 | 94 |
| 91 void drawPaint(const SkDraw&, const SkPaint& paint) override; | 95 void drawPaint(const SkDraw&, const SkPaint& paint) override; |
| 92 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun
t, | 96 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t coun
t, |
| 93 const SkPoint[], const SkPaint& paint) override; | 97 const SkPoint[], const SkPaint& paint) override; |
| 94 virtual void drawRect(const SkDraw&, const SkRect& r, | 98 virtual void drawRect(const SkDraw&, const SkRect& r, |
| 95 const SkPaint& paint) override; | 99 const SkPaint& paint) override; |
| 96 virtual void drawRRect(const SkDraw&, const SkRRect& r, | 100 virtual void drawRRect(const SkDraw&, const SkRRect& r, |
| 97 const SkPaint& paint) override; | 101 const SkPaint& paint) override; |
| 98 virtual void drawDRRect(const SkDraw& draw, const SkRRect& outer, | 102 virtual void drawDRRect(const SkDraw& draw, const SkRRect& outer, |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 const SkImageInfo&, | 274 const SkImageInfo&, |
| 271 int sampleCount, | 275 int sampleCount, |
| 272 const SkSurfaceProps*); | 276 const SkSurfaceProps*); |
| 273 | 277 |
| 274 friend class GrAtlasTextContext; | 278 friend class GrAtlasTextContext; |
| 275 friend class SkSurface_Gpu; // for access to surfaceProps | 279 friend class SkSurface_Gpu; // for access to surfaceProps |
| 276 typedef SkBaseDevice INHERITED; | 280 typedef SkBaseDevice INHERITED; |
| 277 }; | 281 }; |
| 278 | 282 |
| 279 #endif | 283 #endif |
| OLD | NEW |