| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 case kGpu_ImageType: { | 125 case kGpu_ImageType: { |
| 126 SkAutoTUnref<SkSurface> surf( | 126 SkAutoTUnref<SkSurface> surf( |
| 127 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, inf
o, 0)); | 127 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, inf
o, 0)); |
| 128 surf->getCanvas()->clear(color); | 128 surf->getCanvas()->clear(color); |
| 129 return surf->newImageSnapshot(); | 129 return surf->newImageSnapshot(); |
| 130 } | 130 } |
| 131 case kCodec_ImageType: { | 131 case kCodec_ImageType: { |
| 132 SkBitmap bitmap; | 132 SkBitmap bitmap; |
| 133 bitmap.installPixels(info, addr, rowBytes); | 133 bitmap.installPixels(info, addr, rowBytes); |
| 134 SkAutoTUnref<SkData> src( | 134 SkAutoTUnref<SkData> src( |
| 135 SkImageEncoder::EncodeData(bitmap, SkImageEncoder::kPNG_Type, 1
00)); | 135 SkImageEncoder::EncodeData(bitmap, kPNG_SkEncodedFormat, 100)); |
| 136 return SkImage::NewFromData(src); | 136 return SkImage::NewFromData(src); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 SkASSERT(false); | 139 SkASSERT(false); |
| 140 return NULL; | 140 return NULL; |
| 141 } | 141 } |
| 142 | 142 |
| 143 static void set_pixels(SkPMColor pixels[], int count, SkPMColor color) { | 143 static void set_pixels(SkPMColor pixels[], int count, SkPMColor color) { |
| 144 sk_memset32(pixels, color, count); | 144 sk_memset32(pixels, color, count); |
| 145 } | 145 } |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); | 570 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context,
SkSurface::kRetain_ContentChangeMode); |
| 571 TestGetTexture(reporter, kGpu_SurfaceType, context); | 571 TestGetTexture(reporter, kGpu_SurfaceType, context); |
| 572 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); | 572 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); |
| 573 test_empty_surface(reporter, context); | 573 test_empty_surface(reporter, context); |
| 574 test_surface_budget(reporter, context); | 574 test_surface_budget(reporter, context); |
| 575 } | 575 } |
| 576 } | 576 } |
| 577 } | 577 } |
| 578 #endif | 578 #endif |
| 579 } | 579 } |
| OLD | NEW |