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

Side by Side Diff: tests/PDFJpegEmbedTest.cpp

Issue 834633006: add ImageGenerator::NewFromData to porting layer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add helper for SkInstallDiscardablePixelRef(SkData*, ...) Created 5 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkDocument.h" 8 #include "SkDocument.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImageGenerator.h" 10 #include "SkImageGenerator.h"
11 #include "SkData.h" 11 #include "SkData.h"
12 #include "SkStream.h" 12 #include "SkStream.h"
13 #include "SkDecodingImageGenerator.h"
14 13
15 #include "Resources.h" 14 #include "Resources.h"
16 #include "Test.h" 15 #include "Test.h"
17 16
18 // Returned bitmap is lazy. Only lazy bitmaps hold onto the original data. 17 // Returned bitmap is lazy. Only lazy bitmaps hold onto the original data.
19 static SkBitmap bitmap_from_data(SkData* data) { 18 static SkBitmap bitmap_from_data(SkData* data) {
20 SkASSERT(data); 19 SkASSERT(data);
21 SkBitmap bm; 20 SkBitmap bm;
22 SkInstallDiscardablePixelRef( 21 SkInstallDiscardablePixelRef(data, &bm);
23 SkDecodingImageGenerator::Create(
24 data, SkDecodingImageGenerator::Options()), &bm);
25 return bm; 22 return bm;
26 } 23 }
27 24
28 static bool is_subset_of(SkData* smaller, SkData* larger) { 25 static bool is_subset_of(SkData* smaller, SkData* larger) {
29 SkASSERT(smaller && larger); 26 SkASSERT(smaller && larger);
30 if (smaller->size() > larger->size()) { 27 if (smaller->size() > larger->size()) {
31 return false; 28 return false;
32 } 29 }
33 size_t size = smaller->size(); 30 size_t size = smaller->size();
34 size_t size_diff = larger->size() - size; 31 size_t size_diff = larger->size() - size;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 90
94 // The following is for debugging purposes only. 91 // The following is for debugging purposes only.
95 const char* outputPath = getenv("SKIA_TESTS_PDF_JPEG_EMBED_OUTPUT_PATH"); 92 const char* outputPath = getenv("SKIA_TESTS_PDF_JPEG_EMBED_OUTPUT_PATH");
96 if (outputPath) { 93 if (outputPath) {
97 SkFILEWStream output(outputPath); 94 SkFILEWStream output(outputPath);
98 if (output.isValid()) { 95 if (output.isValid()) {
99 output.write(pdfData->data(), pdfData->size()); 96 output.write(pdfData->data(), pdfData->size());
100 } 97 }
101 } 98 }
102 } 99 }
OLDNEW
« include/core/SkImageGenerator.h ('K') | « tests/KtxTest.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698