OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkSurface_Base.h" | 8 #include "SkSurface_Base.h" |
9 #include "SkImagePriv.h" | 9 #include "SkImagePriv.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, | 24 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, |
25 const SkPaint*) SK_OVERRIDE; | 25 const SkPaint*) SK_OVERRIDE; |
26 virtual void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE; | 26 virtual void onCopyOnWrite(ContentChangeMode) SK_OVERRIDE; |
27 | 27 |
28 private: | 28 private: |
29 SkGpuDevice* fDevice; | 29 SkGpuDevice* fDevice; |
30 | 30 |
31 typedef SkSurface_Base INHERITED; | 31 typedef SkSurface_Base INHERITED; |
32 }; | 32 }; |
33 | 33 |
34 SK_DEFINE_INST_COUNT(SkSurface_Gpu) | |
35 | |
36 /////////////////////////////////////////////////////////////////////////////// | 34 /////////////////////////////////////////////////////////////////////////////// |
37 | 35 |
38 SkSurface_Gpu::SkSurface_Gpu(GrContext* ctx, const SkImageInfo& info, | 36 SkSurface_Gpu::SkSurface_Gpu(GrContext* ctx, const SkImageInfo& info, |
39 int sampleCount) | 37 int sampleCount) |
40 : INHERITED(info.fWidth, info.fHeight) { | 38 : INHERITED(info.fWidth, info.fHeight) { |
41 SkBitmap::Config config = SkImageInfoToBitmapConfig(info); | 39 SkBitmap::Config config = SkImageInfoToBitmapConfig(info); |
42 | 40 |
43 fDevice = SkNEW_ARGS(SkGpuDevice, (ctx, config, info.fWidth, info.fHeight, s
ampleCount)); | 41 fDevice = SkNEW_ARGS(SkGpuDevice, (ctx, config, info.fWidth, info.fHeight, s
ampleCount)); |
44 | 42 |
45 if (!SkAlphaTypeIsOpaque(info.fAlphaType)) { | 43 if (!SkAlphaTypeIsOpaque(info.fAlphaType)) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); | 125 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); |
128 desc.fSampleCnt = sampleCount; | 126 desc.fSampleCnt = sampleCount; |
129 | 127 |
130 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0)); | 128 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0)); |
131 if (NULL == tex) { | 129 if (NULL == tex) { |
132 return NULL; | 130 return NULL; |
133 } | 131 } |
134 | 132 |
135 return SkNEW_ARGS(SkSurface_Gpu, (ctx, tex->asRenderTarget())); | 133 return SkNEW_ARGS(SkSurface_Gpu, (ctx, tex->asRenderTarget())); |
136 } | 134 } |
OLD | NEW |