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" |
11 #include "effects/GrTextureDomain.h" | 11 #include "effects/GrTextureDomain.h" |
12 #include "effects/GrSimpleTextureEffect.h" | 12 #include "effects/GrSimpleTextureEffect.h" |
13 | 13 |
14 #include "GrContext.h" | 14 #include "GrContext.h" |
15 #include "GrBitmapTextContext.h" | 15 #include "GrBitmapTextContext.h" |
16 #if SK_DISTANCEFIELD_FONTS | 16 #if SK_DISTANCEFIELD_FONTS |
17 #include "GrDistanceFieldTextContext.h" | 17 #include "GrDistanceFieldTextContext.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #include "SkGrTexturePixelRef.h" | 20 #include "SkGrTexturePixelRef.h" |
21 | 21 |
22 #include "SkColorFilter.h" | 22 #include "SkColorFilter.h" |
23 #include "SkDeviceImageFilterProxy.h" | 23 #include "SkDeviceImageFilterProxy.h" |
24 #include "SkDrawProcs.h" | 24 #include "SkDrawProcs.h" |
25 #include "SkGlyphCache.h" | 25 #include "SkGlyphCache.h" |
26 #include "SkImageFilter.h" | 26 #include "SkImageFilter.h" |
27 #include "SkPathEffect.h" | 27 #include "SkPathEffect.h" |
28 #include "SkRRect.h" | 28 #include "SkRRect.h" |
29 #include "SkStroke.h" | 29 #include "SkStroke.h" |
| 30 #include "SkSurface.h" |
30 #include "SkTLazy.h" | 31 #include "SkTLazy.h" |
31 #include "SkUtils.h" | 32 #include "SkUtils.h" |
32 #include "SkErrorInternals.h" | 33 #include "SkErrorInternals.h" |
33 | 34 |
34 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 | 35 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1 |
35 | 36 |
36 #if 0 | 37 #if 0 |
37 extern bool (*gShouldDrawProc)(); | 38 extern bool (*gShouldDrawProc)(); |
38 #define CHECK_SHOULD_DRAW(draw, forceI) \ | 39 #define CHECK_SHOULD_DRAW(draw, forceI) \ |
39 do { \ | 40 do { \ |
(...skipping 1866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 texture.reset(fContext->createUncachedTexture(desc, NULL, 0)); | 1907 texture.reset(fContext->createUncachedTexture(desc, NULL, 0)); |
1907 #endif | 1908 #endif |
1908 if (NULL != texture.get()) { | 1909 if (NULL != texture.get()) { |
1909 return SkNEW_ARGS(SkGpuDevice,(fContext, texture, needClear)); | 1910 return SkNEW_ARGS(SkGpuDevice,(fContext, texture, needClear)); |
1910 } else { | 1911 } else { |
1911 GrPrintf("---- failed to create compatible device texture [%d %d]\n", wi
dth, height); | 1912 GrPrintf("---- failed to create compatible device texture [%d %d]\n", wi
dth, height); |
1912 return NULL; | 1913 return NULL; |
1913 } | 1914 } |
1914 } | 1915 } |
1915 | 1916 |
| 1917 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) { |
| 1918 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples(
)); |
| 1919 } |
| 1920 |
1916 SkGpuDevice::SkGpuDevice(GrContext* context, | 1921 SkGpuDevice::SkGpuDevice(GrContext* context, |
1917 GrTexture* texture, | 1922 GrTexture* texture, |
1918 bool needClear) | 1923 bool needClear) |
1919 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1924 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
1920 | 1925 |
1921 SkASSERT(texture && texture->asRenderTarget()); | 1926 SkASSERT(texture && texture->asRenderTarget()); |
1922 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1927 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
1923 // cache. We pass true for the third argument so that it will get unlocked. | 1928 // cache. We pass true for the third argument so that it will get unlocked. |
1924 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1929 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
1925 fNeedClear = needClear; | 1930 fNeedClear = needClear; |
1926 } | 1931 } |
OLD | NEW |