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

Side by Side Diff: src/images/SkScaledBitmapSampler.cpp

Issue 322963002: hide SkBitmap::setConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | « src/images/SkImageDecoder_wbmp.cpp ('k') | src/ports/SkFontHost_FreeType_common.cpp » ('j') | 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 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
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 8
9 #include "SkScaledBitmapSampler.h" 9 #include "SkScaledBitmapSampler.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 public: 835 public:
836 DummyDecoder() {} 836 DummyDecoder() {}
837 protected: 837 protected:
838 virtual bool onDecode(SkStream*, SkBitmap*, SkImageDecoder::Mode) SK_OVERRID E { 838 virtual bool onDecode(SkStream*, SkBitmap*, SkImageDecoder::Mode) SK_OVERRID E {
839 return false; 839 return false;
840 } 840 }
841 }; 841 };
842 842
843 void test_row_proc_choice(); 843 void test_row_proc_choice();
844 void test_row_proc_choice() { 844 void test_row_proc_choice() {
845 const SkColorType colorTypes[] = {
846 kAlpha_8_SkColorType, kIndex_8_SkColorType, kRGB_565_SkColorType, kARGB_ 4444_SkColorType,
847 kN32_SkColorType
848 };
849
845 SkBitmap dummyBitmap; 850 SkBitmap dummyBitmap;
846 DummyDecoder dummyDecoder; 851 DummyDecoder dummyDecoder;
847 size_t procCounter = 0; 852 size_t procCounter = 0;
848 for (int sc = SkScaledBitmapSampler::kGray; sc <= SkScaledBitmapSampler::kRG B_565; ++sc) { 853 for (int sc = SkScaledBitmapSampler::kGray; sc <= SkScaledBitmapSampler::kRG B_565; ++sc) {
849 for (int c = SkBitmap::kA8_Config; c <= SkBitmap::kARGB_8888_Config; ++c ) { 854 for (size_t c = 0; c < SK_ARRAY_COUNT(colorTypes); ++c) {
850 for (int unpremul = 0; unpremul <= 1; ++unpremul) { 855 for (int unpremul = 0; unpremul <= 1; ++unpremul) {
851 for (int dither = 0; dither <= 1; ++dither) { 856 for (int dither = 0; dither <= 1; ++dither) {
852 // Arbitrary width/height/sampleSize to allow SkScaledBitmap Sampler to 857 // Arbitrary width/height/sampleSize to allow SkScaledBitmap Sampler to
853 // be considered valid. 858 // be considered valid.
854 SkScaledBitmapSampler sampler(10, 10, 1); 859 SkScaledBitmapSampler sampler(10, 10, 1);
855 dummyBitmap.setConfig((SkBitmap::Config) c, 10, 10); 860 dummyBitmap.setInfo(SkImageInfo::Make(10, 10,
861 colorTypes[c], kPremul _SkAlphaType));
856 dummyDecoder.setDitherImage(SkToBool(dither)); 862 dummyDecoder.setDitherImage(SkToBool(dither));
857 dummyDecoder.setRequireUnpremultipliedColors(SkToBool(unprem ul)); 863 dummyDecoder.setRequireUnpremultipliedColors(SkToBool(unprem ul));
858 sampler.begin(&dummyBitmap, (SkScaledBitmapSampler::SrcConfi g) sc, 864 sampler.begin(&dummyBitmap, (SkScaledBitmapSampler::SrcConfi g) sc,
859 dummyDecoder); 865 dummyDecoder);
860 SkScaledBitmapSampler::RowProc expected = gTestProcs[procCou nter]; 866 SkScaledBitmapSampler::RowProc expected = gTestProcs[procCou nter];
861 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo wProc(sampler); 867 SkScaledBitmapSampler::RowProc actual = RowProcTester::getRo wProc(sampler);
862 SkASSERT(expected == actual); 868 SkASSERT(expected == actual);
863 procCounter++; 869 procCounter++;
864 } 870 }
865 } 871 }
866 } 872 }
867 } 873 }
868 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter); 874 SkASSERT(SK_ARRAY_COUNT(gTestProcs) == procCounter);
869 } 875 }
870 #endif // SK_DEBUG 876 #endif // SK_DEBUG
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_wbmp.cpp ('k') | src/ports/SkFontHost_FreeType_common.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698