| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 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 | 9 |
| 10 #include "HelloWorld.h" | 10 #include "HelloWorld.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 void HelloWorldWindow::draw(SkCanvas* canvas) { | 150 void HelloWorldWindow::draw(SkCanvas* canvas) { |
| 151 drawContents(canvas); | 151 drawContents(canvas); |
| 152 // in case we have queued drawing calls | 152 // in case we have queued drawing calls |
| 153 fContext->flush(); | 153 fContext->flush(); |
| 154 // Invalidate the window to force a redraw. Poor man's animation mechanism. | 154 // Invalidate the window to force a redraw. Poor man's animation mechanism. |
| 155 this->inval(NULL); | 155 this->inval(NULL); |
| 156 | 156 |
| 157 if (kRaster_DeviceType == fType) { | 157 if (kRaster_DeviceType == fType) { |
| 158 // need to send the raster bits to the (gpu) window | 158 // need to send the raster bits to the (gpu) window |
| 159 SkImage* snap = fSurface->newImageSnapshot(); | 159 SkImage* snap = fSurface->newImageSnapshot(); |
| 160 size_t rowBytes; | 160 size_t rowBytes = 0; |
| 161 SkImageInfo info; | 161 SkImageInfo info; |
| 162 const void* pixels = snap->peekPixels(&info, &rowBytes); | 162 const void* pixels = snap->peekPixels(&info, &rowBytes); |
| 163 fRenderTarget->writePixels(0, 0, snap->width(), snap->height(), | 163 fRenderTarget->writePixels(0, 0, snap->width(), snap->height(), |
| 164 SkImageInfo2GrPixelConfig(info.colorType
(), | 164 SkImageInfo2GrPixelConfig(info.colorType
(), |
| 165 info.alphaType()
, | 165 info.alphaType()
, |
| 166 info.profileType
()), | 166 info.profileType
()), |
| 167 pixels, | 167 pixels, |
| 168 rowBytes, | 168 rowBytes, |
| 169 GrContext::kFlushWrites_PixelOp); | 169 GrContext::kFlushWrites_PixelOp); |
| 170 SkSafeUnref(snap); | 170 SkSafeUnref(snap); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 183 setUpBackend(); | 183 setUpBackend(); |
| 184 this->setTitle(); | 184 this->setTitle(); |
| 185 this->inval(NULL); | 185 this->inval(NULL); |
| 186 } | 186 } |
| 187 return true; | 187 return true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 SkOSWindow* create_sk_window(void* hwnd, int , char** ) { | 190 SkOSWindow* create_sk_window(void* hwnd, int , char** ) { |
| 191 return new HelloWorldWindow(hwnd); | 191 return new HelloWorldWindow(hwnd); |
| 192 } | 192 } |
| OLD | NEW |