Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: tests/SurfaceTest.cpp

Issue 579923002: Bis: Use SkImage::NewFromGenerator() instead of SkImage::newEncodedData() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/image.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkDecodingImageGenerator.h"
10 #include "SkImageEncoder.h" 11 #include "SkImageEncoder.h"
11 #include "SkRRect.h" 12 #include "SkRRect.h"
12 #include "SkSurface.h" 13 #include "SkSurface.h"
13 #include "SkUtils.h" 14 #include "SkUtils.h"
14 #include "Test.h" 15 #include "Test.h"
15 16
16 #if SK_SUPPORT_GPU 17 #if SK_SUPPORT_GPU
17 #include "GrContextFactory.h" 18 #include "GrContextFactory.h"
18 #else 19 #else
19 class GrContextFactory; 20 class GrContextFactory;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 case kRasterData_ImageType: 102 case kRasterData_ImageType:
102 return SkImage::NewRasterData(info, data, rowBytes); 103 return SkImage::NewRasterData(info, data, rowBytes);
103 case kGpu_ImageType: 104 case kGpu_ImageType:
104 return NULL; // TODO 105 return NULL; // TODO
105 case kCodec_ImageType: { 106 case kCodec_ImageType: {
106 SkBitmap bitmap; 107 SkBitmap bitmap;
107 bitmap.installPixels(info, addr, rowBytes); 108 bitmap.installPixels(info, addr, rowBytes);
108 SkAutoTUnref<SkData> src( 109 SkAutoTUnref<SkData> src(
109 SkImageEncoder::EncodeData(bitmap, SkImageEncoder::kPNG_Type, 110 SkImageEncoder::EncodeData(bitmap, SkImageEncoder::kPNG_Type,
110 100)); 111 100));
111 return SkImage::NewEncodedData(src); 112 return SkImage::NewFromGenerator(
113 SkDecodingImageGenerator::Create(data, SkDecodingImageGenerator: :Options()));
112 } 114 }
113 } 115 }
114 SkASSERT(false); 116 SkASSERT(false);
115 return NULL; 117 return NULL;
116 } 118 }
117 119
118 static void test_imagepeek(skiatest::Reporter* reporter) { 120 static void test_imagepeek(skiatest::Reporter* reporter) {
119 static const struct { 121 static const struct {
120 ImageType fType; 122 ImageType fType;
121 bool fPeekShouldSucceed; 123 bool fPeekShouldSucceed;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kDiscard_ContentChangeMode); 465 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kDiscard_ContentChangeMode);
464 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa ce::kRetain_ContentChangeMode); 466 TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurfa ce::kRetain_ContentChangeMode);
465 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kRetain_ContentChangeMode); 467 TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kRetain_ContentChangeMode);
466 TestGetTexture(reporter, kGpu_SurfaceType, context); 468 TestGetTexture(reporter, kGpu_SurfaceType, context);
467 TestGetTexture(reporter, kGpuScratch_SurfaceType, context); 469 TestGetTexture(reporter, kGpuScratch_SurfaceType, context);
468 } 470 }
469 } 471 }
470 } 472 }
471 #endif 473 #endif
472 } 474 }
OLDNEW
« no previous file with comments | « gm/image.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698