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

Side by Side Diff: ui/gfx/android/java_bitmap.cc

Issue 2561963002: base: Remove the string logging from CHECK(). (Closed)
Patch Set: checkstring: rebase Created 4 years 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/android/java_bitmap.h" 5 #include "ui/gfx/android/java_bitmap.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 skbitmap.allocPixels(SkImageInfo::MakeN32Premul(src_size.width(), 96 skbitmap.allocPixels(SkImageInfo::MakeN32Premul(src_size.width(),
97 src_size.height()), 97 src_size.height()),
98 jbitmap.stride()); 98 jbitmap.stride());
99 break; 99 break;
100 case ANDROID_BITMAP_FORMAT_A_8: 100 case ANDROID_BITMAP_FORMAT_A_8:
101 skbitmap.allocPixels(SkImageInfo::MakeA8(src_size.width(), 101 skbitmap.allocPixels(SkImageInfo::MakeA8(src_size.width(),
102 src_size.height()), 102 src_size.height()),
103 jbitmap.stride()); 103 jbitmap.stride());
104 break; 104 break;
105 default: 105 default:
106 CHECK(false) << "Invalid Java bitmap format: " << jbitmap.format(); 106 // Invalid Java bitmap format.
107 CHECK(false);
107 break; 108 break;
108 } 109 }
109 CHECK_EQ(jbitmap.byte_count(), static_cast<int>(skbitmap.getSize())); 110 CHECK_EQ(jbitmap.byte_count(), static_cast<int>(skbitmap.getSize()));
110 const void* src_pixels = jbitmap.pixels(); 111 const void* src_pixels = jbitmap.pixels();
111 void* dst_pixels = skbitmap.getPixels(); 112 void* dst_pixels = skbitmap.getPixels();
112 memcpy(dst_pixels, src_pixels, skbitmap.getSize()); 113 memcpy(dst_pixels, src_pixels, skbitmap.getSize());
113 114
114 return skbitmap; 115 return skbitmap;
115 } 116 }
116 117
117 SkColorType ConvertToSkiaColorType(const JavaRef<jobject>& bitmap_config) { 118 SkColorType ConvertToSkiaColorType(const JavaRef<jobject>& bitmap_config) {
118 int jbitmap_config = Java_BitmapHelper_getBitmapFormatForConfig( 119 int jbitmap_config = Java_BitmapHelper_getBitmapFormatForConfig(
119 AttachCurrentThread(), bitmap_config); 120 AttachCurrentThread(), bitmap_config);
120 switch (jbitmap_config) { 121 switch (jbitmap_config) {
121 case BITMAP_FORMAT_ALPHA_8: 122 case BITMAP_FORMAT_ALPHA_8:
122 return kAlpha_8_SkColorType; 123 return kAlpha_8_SkColorType;
123 case BITMAP_FORMAT_ARGB_4444: 124 case BITMAP_FORMAT_ARGB_4444:
124 return kARGB_4444_SkColorType; 125 return kARGB_4444_SkColorType;
125 case BITMAP_FORMAT_ARGB_8888: 126 case BITMAP_FORMAT_ARGB_8888:
126 return kN32_SkColorType; 127 return kN32_SkColorType;
127 case BITMAP_FORMAT_RGB_565: 128 case BITMAP_FORMAT_RGB_565:
128 return kRGB_565_SkColorType; 129 return kRGB_565_SkColorType;
129 case BITMAP_FORMAT_NO_CONFIG: 130 case BITMAP_FORMAT_NO_CONFIG:
130 default: 131 default:
131 return kUnknown_SkColorType; 132 return kUnknown_SkColorType;
132 } 133 }
133 } 134 }
134 135
135 } // namespace gfx 136 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698