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

Side by Side Diff: tests/JpegTest.cpp

Issue 1018953003: Add SkEncodedFormat, used by SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use a common enum for SkImageEncoder and SkImageDecoder and SkCodec Created 5 years, 9 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 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkDecodingImageGenerator.h" 9 #include "SkDecodingImageGenerator.h"
10 #include "SkForceLinking.h" 10 #include "SkForceLinking.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 REPORTER_ASSERT(reporter, bm8888.getColor(127, 127) == 0xff808080 442 REPORTER_ASSERT(reporter, bm8888.getColor(127, 127) == 0xff808080
443 || bm8888.getColor(127, 127) == SK_ColorWHITE); 443 || bm8888.getColor(127, 127) == SK_ColorWHITE);
444 #else 444 #else
445 // This is the fill color 445 // This is the fill color
446 REPORTER_ASSERT(reporter, bm8888.getColor(127, 127) == SK_ColorWHITE); 446 REPORTER_ASSERT(reporter, bm8888.getColor(127, 127) == SK_ColorWHITE);
447 #endif 447 #endif
448 448
449 #if JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING 449 #if JPEG_TEST_WRITE_TO_FILE_FOR_DEBUGGING
450 // Check to see that the resulting bitmap is nice 450 // Check to see that the resulting bitmap is nice
451 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile( 451 bool writeSuccess = (!(bm8888.empty())) && SkImageEncoder::EncodeFile(
452 "HalfOfAJpeg.png", bm8888, SkImageEncoder::kPNG_Type, 100); 452 "HalfOfAJpeg.png", bm8888, kPNG_SkEncodedFormat, 100);
453 SkASSERT(writeSuccess); 453 SkASSERT(writeSuccess);
454 #endif 454 #endif
455 } 455 }
456 456
457 DEF_TEST(Jpeg_YUV, reporter) { 457 DEF_TEST(Jpeg_YUV, reporter) {
458 size_t len = sizeof(goodJpegImage); 458 size_t len = sizeof(goodJpegImage);
459 SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (goodJpegImage, len)); 459 SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (goodJpegImage, len));
460 460
461 SkBitmap bitmap; 461 SkBitmap bitmap;
462 SkDecodingImageGenerator::Options opts; 462 SkDecodingImageGenerator::Options opts;
(...skipping 27 matching lines...) Expand all
490 } 490 }
491 SkAutoMalloc storage(totalSize); 491 SkAutoMalloc storage(totalSize);
492 void* planes[3]; 492 void* planes[3];
493 planes[0] = storage.get(); 493 planes[0] = storage.get();
494 planes[1] = (uint8_t*)planes[0] + sizes[0]; 494 planes[1] = (uint8_t*)planes[0] + sizes[0];
495 planes[2] = (uint8_t*)planes[1] + sizes[1]; 495 planes[2] = (uint8_t*)planes[1] + sizes[1];
496 496
497 // Get the YUV planes 497 // Get the YUV planes
498 REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes , NULL)); 498 REPORTER_ASSERT(reporter, pixelRef->getYUV8Planes(yuvSizes, planes, rowBytes , NULL));
499 } 499 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698