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

Side by Side Diff: src/views/SkWindow.cpp

Issue 1697863002: blitters for sRGB and float16 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkWindow.h" 8 #include "SkWindow.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkOSMenu.h" 10 #include "SkOSMenu.h"
11 #include "SkSurface.h" 11 #include "SkSurface.h"
12 #include "SkSystemEventTypes.h" 12 #include "SkSystemEventTypes.h"
13 #include "SkTime.h" 13 #include "SkTime.h"
14 14
15 #define SK_EventDelayInval "\xd" "n" "\xa" "l" 15 #define SK_EventDelayInval "\xd" "n" "\xa" "l"
16 16
17 SkWindow::SkWindow() 17 SkWindow::SkWindow()
18 : fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) 18 : fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType)
19 , fFocusView(nullptr) 19 , fFocusView(nullptr)
20 { 20 {
21 fClicks.reset(); 21 fClicks.reset();
22 fWaitingOnInval = false; 22 fWaitingOnInval = false;
23 fMatrix.reset(); 23 fMatrix.reset();
24
25 fBitmap.allocN32Pixels(0, 0);
24 } 26 }
25 27
26 SkWindow::~SkWindow() { 28 SkWindow::~SkWindow() {
27 fClicks.deleteAll(); 29 fClicks.deleteAll();
28 fMenus.deleteAll(); 30 fMenus.deleteAll();
29 } 31 }
30 32
31 SkSurface* SkWindow::createSurface() { 33 SkSurface* SkWindow::createSurface() {
32 const SkBitmap& bm = this->getBitmap(); 34 const SkBitmap& bm = this->getBitmap();
33 return SkSurface::NewRasterDirect(bm.info(), bm.getPixels(), bm.rowBytes(), &fSurfaceProps); 35 return SkSurface::NewRasterDirect(bm.info(), bm.getPixels(), bm.rowBytes(), &fSurfaceProps);
(...skipping 11 matching lines...) Expand all
45 m.setConcat(fMatrix, matrix); 47 m.setConcat(fMatrix, matrix);
46 this->setMatrix(m); 48 this->setMatrix(m);
47 } 49 }
48 50
49 void SkWindow::postConcat(const SkMatrix& matrix) { 51 void SkWindow::postConcat(const SkMatrix& matrix) {
50 SkMatrix m; 52 SkMatrix m;
51 m.setConcat(matrix, fMatrix); 53 m.setConcat(matrix, fMatrix);
52 this->setMatrix(m); 54 this->setMatrix(m);
53 } 55 }
54 56
55 void SkWindow::resize(int width, int height) { 57 void SkWindow::resize(const SkImageInfo& info) {
56 if (width != fBitmap.width() || height != fBitmap.height()) { 58 if (fBitmap.info() != info) {
57 fBitmap.allocPixels(SkImageInfo::Make(width, height, kN32_SkColorType, 59 fBitmap.allocPixels(info);
58 kPremul_SkAlphaType));
59 this->inval(nullptr); 60 this->inval(nullptr);
60 } 61 }
61 this->setSize(SkIntToScalar(width), SkIntToScalar(height)); 62 this->setSize(SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height() ));
63 }
64
65 void SkWindow::resize(int width, int height) {
66 this->resize(fBitmap.info().makeWH(width, height));
67 }
68
69 void SkWindow::setColorType(SkColorType ct, SkColorProfileType pt) {
70 const SkImageInfo& info = fBitmap.info();
71 this->resize(SkImageInfo::Make(info.width(), info.height(), ct, kPremul_SkAl phaType, pt));
62 } 72 }
63 73
64 bool SkWindow::handleInval(const SkRect* localR) { 74 bool SkWindow::handleInval(const SkRect* localR) {
65 SkIRect ir; 75 SkIRect ir;
66 76
67 if (localR) { 77 if (localR) {
68 SkRect devR; 78 SkRect devR;
69 SkMatrix inverse; 79 SkMatrix inverse;
70 if (!fMatrix.invert(&inverse)) { 80 if (!fMatrix.invert(&inverse)) {
71 return false; 81 return false;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 desc.fOrigin = kBottomLeft_GrSurfaceOrigin; 330 desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
321 desc.fSampleCnt = attachmentInfo.fSampleCount; 331 desc.fSampleCnt = attachmentInfo.fSampleCount;
322 desc.fStencilBits = attachmentInfo.fStencilBits; 332 desc.fStencilBits = attachmentInfo.fStencilBits;
323 GrGLint buffer; 333 GrGLint buffer;
324 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer); 334 GR_GL_GetIntegerv(interface, GR_GL_FRAMEBUFFER_BINDING, &buffer);
325 desc.fRenderTargetHandle = buffer; 335 desc.fRenderTargetHandle = buffer;
326 return grContext->textureProvider()->wrapBackendRenderTarget(desc); 336 return grContext->textureProvider()->wrapBackendRenderTarget(desc);
327 } 337 }
328 338
329 #endif 339 #endif
OLDNEW
« no previous file with comments | « src/image/SkSurface_Raster.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698