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

Side by Side Diff: tools/skpdiff/SkCLImageDiffer.cpp

Issue 338493005: stop using SkBitmap::Config (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
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 <cstring> 8 #include <cstring>
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 SkDebugf("Kernel creation failed: %s\n", cl_error_to_string(kernelErr)); 80 SkDebugf("Kernel creation failed: %s\n", cl_error_to_string(kernelErr));
81 return false; 81 return false;
82 } 82 }
83 83
84 return true; 84 return true;
85 } 85 }
86 86
87 bool SkCLImageDiffer::makeImage2D(SkBitmap* bitmap, cl_mem* image) const { 87 bool SkCLImageDiffer::makeImage2D(SkBitmap* bitmap, cl_mem* image) const {
88 cl_int imageErr; 88 cl_int imageErr;
89 cl_image_format bitmapFormat; 89 cl_image_format bitmapFormat;
90 switch (bitmap->config()) { 90 switch (bitmap->colorType()) {
91 case SkBitmap::kA8_Config: 91 case kAlpha_8_SkColorType:
92 bitmapFormat.image_channel_order = CL_A; 92 bitmapFormat.image_channel_order = CL_A;
93 bitmapFormat.image_channel_data_type = CL_UNSIGNED_INT8; 93 bitmapFormat.image_channel_data_type = CL_UNSIGNED_INT8;
94 break; 94 break;
95 case SkBitmap::kRGB_565_Config: 95 case kRGB_565_SkColorType:
96 bitmapFormat.image_channel_order = CL_RGB; 96 bitmapFormat.image_channel_order = CL_RGB;
97 bitmapFormat.image_channel_data_type = CL_UNORM_SHORT_565; 97 bitmapFormat.image_channel_data_type = CL_UNORM_SHORT_565;
98 break; 98 break;
99 case SkBitmap::kARGB_8888_Config: 99 case kN32_SkColorType:
100 bitmapFormat.image_channel_order = CL_RGBA; 100 bitmapFormat.image_channel_order = CL_RGBA;
101 bitmapFormat.image_channel_data_type = CL_UNSIGNED_INT8; 101 bitmapFormat.image_channel_data_type = CL_UNSIGNED_INT8;
102 break; 102 break;
103 default: 103 default:
104 SkDebugf("Image format is unsupported\n"); 104 SkDebugf("Image format is unsupported\n");
105 return false; 105 return false;
106 } 106 }
107 107
108 // Upload the bitmap data to OpenCL 108 // Upload the bitmap data to OpenCL
109 bitmap->lockPixels(); 109 bitmap->lockPixels();
110 *image = clCreateImage2D(fContext, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, 110 *image = clCreateImage2D(fContext, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
111 &bitmapFormat, bitmap->width(), bitmap->height(), 111 &bitmapFormat, bitmap->width(), bitmap->height(),
112 bitmap->rowBytes(), bitmap->getPixels(), 112 bitmap->rowBytes(), bitmap->getPixels(),
113 &imageErr); 113 &imageErr);
114 bitmap->unlockPixels(); 114 bitmap->unlockPixels();
115 115
116 if (CL_SUCCESS != imageErr) { 116 if (CL_SUCCESS != imageErr) {
117 SkDebugf("Input image creation failed: %s\n", cl_error_to_string(imageEr r)); 117 SkDebugf("Input image creation failed: %s\n", cl_error_to_string(imageEr r));
118 return false; 118 return false;
119 } 119 }
120 120
121 return true; 121 return true;
122 } 122 }
OLDNEW
« src/images/SkImageDecoder_libwebp.cpp ('K') | « tools/picture_utils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698