OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
9 | 9 |
10 #include "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 SkGpuDevice::SkGpuDevice(GrSurface* surface, const SkSurfaceProps& props, unsign
ed flags) { | 144 SkGpuDevice::SkGpuDevice(GrSurface* surface, const SkSurfaceProps& props, unsign
ed flags) { |
145 | 145 |
146 fDrawProcs = NULL; | 146 fDrawProcs = NULL; |
147 | 147 |
148 fContext = SkRef(surface->getContext()); | 148 fContext = SkRef(surface->getContext()); |
149 | 149 |
150 fNeedClear = flags & kNeedClear_Flag; | 150 fNeedClear = flags & kNeedClear_Flag; |
151 | 151 |
152 fRenderTarget = SkRef(surface->asRenderTarget()); | 152 fRenderTarget = SkRef(surface->asRenderTarget()); |
153 | 153 |
154 SkImageInfo info = surface->surfacePriv().info(); | |
155 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, | 154 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, |
156 (info, surface, SkToBool(flags & kCached_Flag)))
; | 155 (surface->info(), surface, SkToBool(flags & kCac
hed_Flag))); |
157 fLegacyBitmap.setInfo(info); | 156 fLegacyBitmap.setInfo(surface->info()); |
158 fLegacyBitmap.setPixelRef(pr)->unref(); | 157 fLegacyBitmap.setPixelRef(pr)->unref(); |
159 | 158 |
160 this->setPixelGeometry(props.pixelGeometry()); | 159 this->setPixelGeometry(props.pixelGeometry()); |
161 | 160 |
162 bool useDFFonts = !!(flags & kDFFonts_Flag); | 161 bool useDFFonts = !!(flags & kDFFonts_Flag); |
163 fMainTextContext = fContext->createTextContext(fRenderTarget, this->getLeaky
Properties(), useDFFonts); | 162 fMainTextContext = fContext->createTextContext(fRenderTarget, this->getLeaky
Properties(), useDFFonts); |
164 fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, this->getL
eakyProperties())); | 163 fFallbackTextContext = SkNEW_ARGS(GrBitmapTextContext, (fContext, this->getL
eakyProperties())); |
165 } | 164 } |
166 | 165 |
167 SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo
, | 166 SkGpuDevice* SkGpuDevice::Create(GrContext* context, const SkImageInfo& origInfo
, |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 // Draw the mask into maskTexture with the path's top-left at the origin usi
ng tempPaint. | 684 // Draw the mask into maskTexture with the path's top-left at the origin usi
ng tempPaint. |
686 SkMatrix translate; | 685 SkMatrix translate; |
687 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); | 686 translate.setTranslate(-maskRect.fLeft, -maskRect.fTop); |
688 am.set(context, translate); | 687 am.set(context, translate); |
689 context->drawPath(tempPaint, devPath, strokeInfo); | 688 context->drawPath(tempPaint, devPath, strokeInfo); |
690 return true; | 689 return true; |
691 } | 690 } |
692 | 691 |
693 SkBitmap wrap_texture(GrTexture* texture) { | 692 SkBitmap wrap_texture(GrTexture* texture) { |
694 SkBitmap result; | 693 SkBitmap result; |
695 result.setInfo(texture->surfacePriv().info()); | 694 result.setInfo(texture->info()); |
696 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unre
f(); | 695 result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unre
f(); |
697 return result; | 696 return result; |
698 } | 697 } |
699 | 698 |
700 }; | 699 }; |
701 | 700 |
702 void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, | 701 void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath, |
703 const SkPaint& paint, const SkMatrix* prePathMatrix, | 702 const SkPaint& paint, const SkMatrix* prePathMatrix, |
704 bool pathIsMutable) { | 703 bool pathIsMutable) { |
705 CHECK_FOR_ANNOTATION(paint); | 704 CHECK_FOR_ANNOTATION(paint); |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), atlased, nonAtlased)
; | 1869 GrLayerHoister::UnlockLayers(fContext->getLayerCache(), atlased, nonAtlased)
; |
1871 | 1870 |
1872 return true; | 1871 return true; |
1873 } | 1872 } |
1874 | 1873 |
1875 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1874 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1876 // We always return a transient cache, so it is freed after each | 1875 // We always return a transient cache, so it is freed after each |
1877 // filter traversal. | 1876 // filter traversal. |
1878 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1877 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1879 } | 1878 } |
OLD | NEW |