| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImage::Info& info,
int sampleCount) { | 120 SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, const SkImage::Info& info,
int sampleCount) { |
| 121 if (NULL == ctx) { | 121 if (NULL == ctx) { |
| 122 return NULL; | 122 return NULL; |
| 123 } | 123 } |
| 124 | 124 |
| 125 bool isOpaque; | 125 bool isOpaque; |
| 126 SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque); | 126 SkBitmap::Config config = SkImageInfoToBitmapConfig(info, &isOpaque); |
| 127 | 127 |
| 128 GrTextureDesc desc; | 128 GrTextureDesc desc; |
| 129 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 129 desc.fFlags = kRenderTarget_GrTextureFlagBit | kCheckAllocation_GrTextureFla
gBit; |
| 130 desc.fWidth = info.fWidth; | 130 desc.fWidth = info.fWidth; |
| 131 desc.fHeight = info.fHeight; | 131 desc.fHeight = info.fHeight; |
| 132 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); | 132 desc.fConfig = SkBitmapConfig2GrPixelConfig(config); |
| 133 desc.fSampleCnt = sampleCount; | 133 desc.fSampleCnt = sampleCount; |
| 134 | 134 |
| 135 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0)); | 135 SkAutoTUnref<GrTexture> tex(ctx->createUncachedTexture(desc, NULL, 0)); |
| 136 if (NULL == tex) { | 136 if (NULL == tex) { |
| 137 return NULL; | 137 return NULL; |
| 138 } | 138 } |
| 139 | 139 |
| 140 return SkNEW_ARGS(SkSurface_Gpu, (ctx, tex->asRenderTarget())); | 140 return SkNEW_ARGS(SkSurface_Gpu, (ctx, tex->asRenderTarget())); |
| 141 } | 141 } |
| OLD | NEW |