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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 switch (imageType) { | 95 switch (imageType) { |
96 case kRasterCopy_ImageType: | 96 case kRasterCopy_ImageType: |
97 return SkImage::NewRasterCopy(info, addr, rowBytes); | 97 return SkImage::NewRasterCopy(info, addr, rowBytes); |
98 case kRasterData_ImageType: | 98 case kRasterData_ImageType: |
99 return SkImage::NewRasterData(info, data, rowBytes); | 99 return SkImage::NewRasterData(info, data, rowBytes); |
100 case kGpu_ImageType: | 100 case kGpu_ImageType: |
101 return NULL; // TODO | 101 return NULL; // TODO |
102 case kCodec_ImageType: { | 102 case kCodec_ImageType: { |
103 SkBitmap bitmap; | 103 SkBitmap bitmap; |
104 bitmap.installPixels(info, addr, rowBytes, NULL, NULL); | 104 bitmap.installPixels(info, addr, rowBytes); |
105 SkAutoTUnref<SkData> src( | 105 SkAutoTUnref<SkData> src( |
106 SkImageEncoder::EncodeData(bitmap, SkImageEncoder::kPNG_Type, | 106 SkImageEncoder::EncodeData(bitmap, SkImageEncoder::kPNG_Type, |
107 100)); | 107 100)); |
108 return SkImage::NewEncodedData(src); | 108 return SkImage::NewEncodedData(src); |
109 } | 109 } |
110 } | 110 } |
111 SkASSERT(false); | 111 SkASSERT(false); |
112 return NULL; | 112 return NULL; |
113 } | 113 } |
114 | 114 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kDiscard_ContentChangeMode); | 438 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kDiscard_ContentChangeMode); |
439 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kDiscard_ContentChangeMode); | 439 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kDiscard_ContentChangeMode); |
440 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kRetain_ContentChangeMode); | 440 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::
kRetain_ContentChangeMode); |
441 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kRetain_ContentChangeMode); | 441 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSu
rface::kRetain_ContentChangeMode); |
442 TestGetTexture(reporter, kGpu_SurfaceType, context); | 442 TestGetTexture(reporter, kGpu_SurfaceType, context); |
443 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); | 443 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); |
444 } | 444 } |
445 } | 445 } |
446 #endif | 446 #endif |
447 } | 447 } |
OLD | NEW |