| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 void HelloWorldWindow::draw(SkCanvas* canvas) { | 144 void HelloWorldWindow::draw(SkCanvas* canvas) { |
| 145 drawContents(canvas); | 145 drawContents(canvas); |
| 146 // in case we have queued drawing calls | 146 // in case we have queued drawing calls |
| 147 fContext->flush(); | 147 fContext->flush(); |
| 148 // Invalidate the window to force a redraw. Poor man's animation mechanism. | 148 // Invalidate the window to force a redraw. Poor man's animation mechanism. |
| 149 this->inval(NULL); | 149 this->inval(NULL); |
| 150 | 150 |
| 151 if (kRaster_DeviceType == fType) { | 151 if (kRaster_DeviceType == fType) { |
| 152 // need to send the raster bits to the (gpu) window | 152 // need to send the raster bits to the (gpu) window |
| 153 sk_sp<SkImage> snap = sk_sp<SkImage>(fSurface->newImageSnapshot()); | 153 sk_sp<SkImage> snap = fSurface->makeImageSnapshot(); |
| 154 SkPixmap pmap; | 154 SkPixmap pmap; |
| 155 if (snap->peekPixels(&pmap)) { | 155 if (snap->peekPixels(&pmap)) { |
| 156 const SkImageInfo& info = pmap.info(); | 156 const SkImageInfo& info = pmap.info(); |
| 157 fRenderTarget->writePixels(0, 0, snap->width(), snap->height(), | 157 fRenderTarget->writePixels(0, 0, snap->width(), snap->height(), |
| 158 SkImageInfo2GrPixelConfig(info.color
Type(), | 158 SkImageInfo2GrPixelConfig(info.color
Type(), |
| 159 info.alphaTy
pe(), | 159 info.alphaTy
pe(), |
| 160 info.profile
Type()), | 160 info.profile
Type()), |
| 161 pmap.addr(), | 161 pmap.addr(), |
| 162 pmap.rowBytes(), | 162 pmap.rowBytes(), |
| 163 GrContext::kFlushWrites_PixelOp); | 163 GrContext::kFlushWrites_PixelOp); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 177 setUpBackend(); | 177 setUpBackend(); |
| 178 this->setTitle(); | 178 this->setTitle(); |
| 179 this->inval(NULL); | 179 this->inval(NULL); |
| 180 } | 180 } |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| 183 | 183 |
| 184 SkOSWindow* create_sk_window(void* hwnd, int , char** ) { | 184 SkOSWindow* create_sk_window(void* hwnd, int , char** ) { |
| 185 return new HelloWorldWindow(hwnd); | 185 return new HelloWorldWindow(hwnd); |
| 186 } | 186 } |
| OLD | NEW |