SampleApp: Remove SkWindow::setColorType
Remove SkWindow::setColorType, it is used wrong and inconsistently. The color type is actually property of window backbuffer, used when the window is painted with software. This is as opposed to a generic window property that would affect all operation. Similar to MSAA sample count for window GPU backbuffer, the bitmap backbuffer color type should be a parameter of "attach" or "create window" functions, should this property ever be added back. The apps use the call wrong, setting the type as kRGBA_8888 or kBGRRA_8888 without no apparent rationale. These color types are incorrect, as the raster surface can not work with these. Reorganize the SkWindow::resize, since no change in SkWindow backbuffer size does not neccessarily mean that SkView would not need the call. Do not show the sw backbuffer color type in SampleApp title, as it does not really provide any information. On small screens, kBGRA_8888_ColorType fills up the whole title. BUG=skia:4733 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1595503002 Review URL: https://codereview.chromium.org/1595503002
This commit is contained in:
parent
3ca7336049
commit
973d92cf91
@ -59,7 +59,6 @@ void HelloWorldWindow::setTitle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool HelloWorldWindow::setUpBackend() {
|
bool HelloWorldWindow::setUpBackend() {
|
||||||
this->setColorType(kRGBA_8888_SkColorType);
|
|
||||||
this->setVisibleP(true);
|
this->setVisibleP(true);
|
||||||
this->setClipToBounds(false);
|
this->setClipToBounds(false);
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ SkV8ExampleWindow::SkV8ExampleWindow(void* hwnd, JsContext* context)
|
|||||||
, fCurSurface(NULL)
|
, fCurSurface(NULL)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
this->setColorType(kBGRA_8888_SkColorType);
|
|
||||||
this->setVisibleP(true);
|
this->setVisibleP(true);
|
||||||
this->setClipToBounds(false);
|
this->setClipToBounds(false);
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011 Google Inc.
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by a BSD-style license that can be
|
||||||
|
* found in the LICENSE file.
|
||||||
|
*/
|
||||||
#import "SkUIView.h"
|
#import "SkUIView.h"
|
||||||
#include "SkCanvas.h"
|
#include "SkCanvas.h"
|
||||||
#include "SkCGUtils.h"
|
#include "SkCGUtils.h"
|
||||||
@ -29,8 +35,7 @@
|
|||||||
- (void)setUpWindow {
|
- (void)setUpWindow {
|
||||||
if (NULL != fWind) {
|
if (NULL != fWind) {
|
||||||
fWind->setVisibleP(true);
|
fWind->setVisibleP(true);
|
||||||
fWind->resize(self.frame.size.width, self.frame.size.height,
|
fWind->resize(self.frame.size.width, self.frame.size.height);
|
||||||
kN32_SkColorType);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,8 +326,7 @@ static FPSState gFPS;
|
|||||||
fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer);
|
fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer);
|
||||||
fWind = new SampleWindow(self, argc, argv, fDevManager);
|
fWind = new SampleWindow(self, argc, argv, fDevManager);
|
||||||
|
|
||||||
fWind->resize(self.frame.size.width, self.frame.size.height,
|
fWind->resize(self.frame.size.width, self.frame.size.height);
|
||||||
kN32_SkColorType);
|
|
||||||
|
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
delete [] argv[i];
|
delete [] argv[i];
|
||||||
|
@ -43,8 +43,7 @@ public:
|
|||||||
|
|
||||||
const SkBitmap& getBitmap() const { return fBitmap; }
|
const SkBitmap& getBitmap() const { return fBitmap; }
|
||||||
|
|
||||||
void setColorType(SkColorType);
|
void resize(int width, int height);
|
||||||
void resize(int width, int height, SkColorType = kUnknown_SkColorType);
|
|
||||||
|
|
||||||
bool isDirty() const { return !fDirtyRgn.isEmpty(); }
|
bool isDirty() const { return !fDirtyRgn.isEmpty(); }
|
||||||
bool update(SkIRect* updateArea);
|
bool update(SkIRect* updateArea);
|
||||||
@ -96,7 +95,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SkSurfaceProps fSurfaceProps;
|
SkSurfaceProps fSurfaceProps;
|
||||||
SkColorType fColorType;
|
|
||||||
SkBitmap fBitmap;
|
SkBitmap fBitmap;
|
||||||
SkRegion fDirtyRgn;
|
SkRegion fDirtyRgn;
|
||||||
|
|
||||||
|
@ -1982,9 +1982,6 @@ void SampleWindow::updateTitle() {
|
|||||||
|
|
||||||
title.prepend(gDeviceTypePrefix[fDeviceType]);
|
title.prepend(gDeviceTypePrefix[fDeviceType]);
|
||||||
|
|
||||||
title.prepend(" ");
|
|
||||||
title.prepend(sk_tool_utils::colortype_name(this->getBitmap().colorType()));
|
|
||||||
|
|
||||||
if (fTilingMode != kNo_Tiling) {
|
if (fTilingMode != kNo_Tiling) {
|
||||||
title.prependf("<T: %s> ", gTilingInfo[fTilingMode].label);
|
title.prependf("<T: %s> ", gTilingInfo[fTilingMode].label);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ SkWindow::SkWindow()
|
|||||||
{
|
{
|
||||||
fClicks.reset();
|
fClicks.reset();
|
||||||
fWaitingOnInval = false;
|
fWaitingOnInval = false;
|
||||||
fColorType = kN32_SkColorType;
|
|
||||||
fMatrix.reset();
|
fMatrix.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,22 +52,13 @@ void SkWindow::postConcat(const SkMatrix& matrix) {
|
|||||||
this->setMatrix(m);
|
this->setMatrix(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkWindow::setColorType(SkColorType ct) {
|
void SkWindow::resize(int width, int height) {
|
||||||
this->resize(fBitmap.width(), fBitmap.height(), ct);
|
if (width != fBitmap.width() || height != fBitmap.height()) {
|
||||||
}
|
fBitmap.allocPixels(SkImageInfo::Make(width, height, kN32_SkColorType,
|
||||||
|
kPremul_SkAlphaType));
|
||||||
void SkWindow::resize(int width, int height, SkColorType ct) {
|
|
||||||
if (ct == kUnknown_SkColorType)
|
|
||||||
ct = fColorType;
|
|
||||||
|
|
||||||
if (width != fBitmap.width() || height != fBitmap.height() || ct != fColorType) {
|
|
||||||
fColorType = ct;
|
|
||||||
fBitmap.allocPixels(SkImageInfo::Make(width, height,
|
|
||||||
ct, kPremul_SkAlphaType));
|
|
||||||
|
|
||||||
this->setSize(SkIntToScalar(width), SkIntToScalar(height));
|
|
||||||
this->inval(nullptr);
|
this->inval(nullptr);
|
||||||
}
|
}
|
||||||
|
this->setSize(SkIntToScalar(width), SkIntToScalar(height));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SkWindow::handleInval(const SkRect* localR) {
|
bool SkWindow::handleInval(const SkRect* localR) {
|
||||||
|
@ -56,8 +56,7 @@ static_assert(SK_SUPPORT_GPU, "not_implemented_for_non_gpu_build");
|
|||||||
#if RETINA_API_AVAILABLE
|
#if RETINA_API_AVAILABLE
|
||||||
size = [self convertSizeToBacking:self.frame.size];
|
size = [self convertSizeToBacking:self.frame.size];
|
||||||
#endif
|
#endif
|
||||||
fWind->resize((int) size.width, (int) size.height,
|
fWind->resize((int) size.width, (int) size.height);
|
||||||
kN32_SkColorType);
|
|
||||||
[[self window] setAcceptsMouseMovedEvents:YES];
|
[[self window] setAcceptsMouseMovedEvents:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,6 @@ SkSurface* VisualBench::createSurface() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool VisualBench::setupBackend() {
|
bool VisualBench::setupBackend() {
|
||||||
this->setColorType(kRGBA_8888_SkColorType);
|
|
||||||
this->setVisibleP(true);
|
this->setVisibleP(true);
|
||||||
this->setClipToBounds(false);
|
this->setClipToBounds(false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user