OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
10 #include "ppapi/cpp/graphics_2d.h" | 10 #include "ppapi/cpp/graphics_2d.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 fHeight = position.size().height(); | 160 fHeight = position.size().height(); |
161 | 161 |
162 fDeviceContext = pp::Graphics2D(this, pp::Size(fWidth, fHeight), false); | 162 fDeviceContext = pp::Graphics2D(this, pp::Size(fWidth, fHeight), false); |
163 if (!BindGraphics(fDeviceContext)) { | 163 if (!BindGraphics(fDeviceContext)) { |
164 SkDebugf("Couldn't bind the device context\n"); | 164 SkDebugf("Couldn't bind the device context\n"); |
165 return; | 165 return; |
166 } | 166 } |
167 fImage = pp::ImageData(this, | 167 fImage = pp::ImageData(this, |
168 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 168 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
169 pp::Size(fWidth, fHeight), false); | 169 pp::Size(fWidth, fHeight), false); |
170 fBitmap.setConfig(SkBitmap::kARGB_8888_Config, fWidth, fHeight); | 170 const SkImageInfo info = SkImageInfo::MakeN32Premul(fWidth, fHeight); |
171 fBitmap.setPixels(fImage.data()); | 171 fBitmap.installPixels(info, fImage.data(), info.minRowBytes()); |
172 if (fCanvas) { | 172 if (fCanvas) { |
173 delete fCanvas; | 173 delete fCanvas; |
174 } | 174 } |
175 fCanvas = new SkCanvas(fBitmap); | 175 fCanvas = new SkCanvas(fBitmap); |
176 fCanvas->clear(SK_ColorWHITE); | 176 fCanvas->clear(SK_ColorWHITE); |
177 if (!fFlushLoopRunning) { | 177 if (!fFlushLoopRunning) { |
178 Paint(); | 178 Paint(); |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
(...skipping 29 matching lines...) Expand all Loading... |
211 virtual pp::Instance* CreateInstance(PP_Instance instance) { | 211 virtual pp::Instance* CreateInstance(PP_Instance instance) { |
212 return new SkiaInstance(instance); | 212 return new SkiaInstance(instance); |
213 } | 213 } |
214 }; | 214 }; |
215 | 215 |
216 namespace pp { | 216 namespace pp { |
217 Module* CreateModule() { | 217 Module* CreateModule() { |
218 return new SkiaModule(); | 218 return new SkiaModule(); |
219 } | 219 } |
220 } // namespace pp | 220 } // namespace pp |
OLD | NEW |