OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 #include "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 this->internalSaveLayer(rec, strategy); | 1136 this->internalSaveLayer(rec, strategy); |
1137 return this->getSaveCount() - 1; | 1137 return this->getSaveCount() - 1; |
1138 } | 1138 } |
1139 | 1139 |
1140 static void draw_filter_into_device(SkBaseDevice* src, const SkImageFilter* filt
er, | 1140 static void draw_filter_into_device(SkBaseDevice* src, const SkImageFilter* filt
er, |
1141 SkBaseDevice* dst, const SkMatrix& ctm) { | 1141 SkBaseDevice* dst, const SkMatrix& ctm) { |
1142 | 1142 |
1143 SkBitmap srcBM; | 1143 SkBitmap srcBM; |
1144 | 1144 |
1145 #if SK_SUPPORT_GPU | 1145 #if SK_SUPPORT_GPU |
| 1146 // TODO: remove this virtual usage of accessRenderTarget! It is preventing |
| 1147 // removal of the virtual on SkBaseDevice. |
1146 GrRenderTarget* srcRT = src->accessRenderTarget(); | 1148 GrRenderTarget* srcRT = src->accessRenderTarget(); |
1147 if (srcRT && !srcRT->asTexture() && dst->accessRenderTarget()) { | 1149 if (srcRT && !srcRT->asTexture() && dst->accessRenderTarget()) { |
1148 // When both the src & the dst are on the gpu but the src doesn't have a
texture, | 1150 // When both the src & the dst are on the gpu but the src doesn't have a
texture, |
1149 // we create a temporary texture for the draw. | 1151 // we create a temporary texture for the draw. |
1150 // TODO: we should actually only copy the portion of the source needed t
o apply the image | 1152 // TODO: we should actually only copy the portion of the source needed t
o apply the image |
1151 // filter | 1153 // filter |
1152 GrContext* context = srcRT->getContext(); | 1154 GrContext* context = srcRT->getContext(); |
1153 SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(sr
cRT->desc(), | 1155 SkAutoTUnref<GrTexture> tex(context->textureProvider()->createTexture(sr
cRT->desc(), |
1154 Sk
Budgeted::kYes)); | 1156 Sk
Budgeted::kYes)); |
1155 | 1157 |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 } | 1853 } |
1852 | 1854 |
1853 const SkMatrix& SkCanvas::getTotalMatrix() const { | 1855 const SkMatrix& SkCanvas::getTotalMatrix() const { |
1854 return fMCRec->fMatrix; | 1856 return fMCRec->fMatrix; |
1855 } | 1857 } |
1856 | 1858 |
1857 const SkRegion& SkCanvas::internal_private_getTotalClip() const { | 1859 const SkRegion& SkCanvas::internal_private_getTotalClip() const { |
1858 return fMCRec->fRasterClip.forceGetBW(); | 1860 return fMCRec->fRasterClip.forceGetBW(); |
1859 } | 1861 } |
1860 | 1862 |
1861 GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() { | 1863 GrDrawContext* SkCanvas::internal_private_accessTopLayerDrawContext() { |
1862 SkBaseDevice* dev = this->getTopDevice(); | 1864 SkBaseDevice* dev = this->getTopDevice(); |
1863 return dev ? dev->accessRenderTarget() : nullptr; | 1865 return dev ? dev->accessDrawContext() : nullptr; |
1864 } | 1866 } |
1865 | 1867 |
1866 GrContext* SkCanvas::getGrContext() { | 1868 GrContext* SkCanvas::getGrContext() { |
1867 SkBaseDevice* device = this->getTopDevice(); | 1869 SkBaseDevice* device = this->getTopDevice(); |
1868 return device ? device->context() : nullptr; | 1870 return device ? device->context() : nullptr; |
1869 } | 1871 } |
1870 | 1872 |
1871 void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner, | 1873 void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner, |
1872 const SkPaint& paint) { | 1874 const SkPaint& paint) { |
1873 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawDRRect()"); | 1875 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawDRRect()"); |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3062 | 3064 |
3063 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 3065 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
3064 fCanvas->restoreToCount(fSaveCount); | 3066 fCanvas->restoreToCount(fSaveCount); |
3065 } | 3067 } |
3066 | 3068 |
3067 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API | 3069 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API |
3068 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { | 3070 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p
rops) { |
3069 return this->makeSurface(info, props).release(); | 3071 return this->makeSurface(info, props).release(); |
3070 } | 3072 } |
3071 #endif | 3073 #endif |
OLD | NEW |