Revert of Add getReducedClipStack to lua canvas (https://codereview.chromium.org/180283004/)
Reason for revert: breaking a bunch of builds Original issue's description: > Add getReducedClipStack to lua canvas > > Committed: http://code.google.com/p/skia/source/detail?r=13594 R=reed@google.com TBR=reed@google.com NOTREECHECKS=true NOTRY=true Author: bsalomon@google.com Review URL: https://codereview.chromium.org/181653004 git-svn-id: http://skia.googlecode.com/svn/trunk@13597 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
b805fe5884
commit
1caedbb216
@ -189,11 +189,6 @@
|
|||||||
'../tools/lua/lua_app.cpp',
|
'../tools/lua/lua_app.cpp',
|
||||||
'../src/utils/SkLua.cpp',
|
'../src/utils/SkLua.cpp',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
|
||||||
# Lua exposes GrReduceClip which in turn requires src/core for SkTLList
|
|
||||||
'../src/gpu/',
|
|
||||||
'../src/core/',
|
|
||||||
],
|
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'effects.gyp:effects',
|
'effects.gyp:effects',
|
||||||
'images.gyp:images',
|
'images.gyp:images',
|
||||||
@ -212,11 +207,6 @@
|
|||||||
'../src/utils/SkLuaCanvas.cpp',
|
'../src/utils/SkLuaCanvas.cpp',
|
||||||
'../src/utils/SkLua.cpp',
|
'../src/utils/SkLua.cpp',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
|
||||||
# Lua exposes GrReduceClip which in turn requires src/core for SkTLList
|
|
||||||
'../src/gpu/',
|
|
||||||
'../src/core/',
|
|
||||||
],
|
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'effects.gyp:effects',
|
'effects.gyp:effects',
|
||||||
'flags.gyp:flags',
|
'flags.gyp:flags',
|
||||||
|
@ -90,16 +90,12 @@ public:
|
|||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size of the base or root layer in global canvas coordinates. The
|
* DEPRECATED: call imageInfo() instead.
|
||||||
* origin of the base layer is always (0,0). The current drawable area may be
|
* Return the width/height of the underlying device. The current drawable
|
||||||
* smaller (due to clipping or saveLayer).
|
* area may be small (due to clipping or saveLayer). For a canvas with
|
||||||
|
* no device, 0,0 will be returned.
|
||||||
*/
|
*/
|
||||||
SkISize getBaseLayerSize() const;
|
SkISize getDeviceSize() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* DEPRECATED: call getBaseLayerSize
|
|
||||||
*/
|
|
||||||
SkISize getDeviceSize() const { return this->getBaseLayerSize(); }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED.
|
* DEPRECATED.
|
||||||
@ -1133,7 +1129,6 @@ private:
|
|||||||
|
|
||||||
friend class SkDrawIter; // needs setupDrawForLayerDevice()
|
friend class SkDrawIter; // needs setupDrawForLayerDevice()
|
||||||
friend class AutoDrawLooper;
|
friend class AutoDrawLooper;
|
||||||
friend class SkLua; // needs top layer size and offset
|
|
||||||
|
|
||||||
SkBaseDevice* createLayerDevice(const SkImageInfo&);
|
SkBaseDevice* createLayerDevice(const SkImageInfo&);
|
||||||
|
|
||||||
@ -1148,12 +1143,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
SkBaseDevice* setRootDevice(SkBaseDevice* device);
|
SkBaseDevice* setRootDevice(SkBaseDevice* device);
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the size/origin of the top level layer in global canvas coordinates. We don't want this
|
|
||||||
* to be public because it exposes decisions about layer sizes that are internal to the canvas.
|
|
||||||
*/
|
|
||||||
SkISize getTopLayerSize() const;
|
|
||||||
SkIPoint getTopLayerOrigin() const;
|
|
||||||
|
|
||||||
// internal methods are not virtual, so they can safely be called by other
|
// internal methods are not virtual, so they can safely be called by other
|
||||||
// canvas apis, without confusing subclasses (like SkPictureRecording)
|
// canvas apis, without confusing subclasses (like SkPictureRecording)
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#ifndef SkLua_DEFINED
|
#ifndef SkLua_DEFINED
|
||||||
#define SkLua_DEFINED
|
#define SkLua_DEFINED
|
||||||
|
|
||||||
#include "SkClipStack.h"
|
|
||||||
#include "SkColor.h"
|
#include "SkColor.h"
|
||||||
#include "SkScalar.h"
|
#include "SkScalar.h"
|
||||||
#include "SkString.h"
|
#include "SkString.h"
|
||||||
@ -16,6 +15,7 @@
|
|||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
|
||||||
class SkCanvas;
|
class SkCanvas;
|
||||||
|
class SkClipStack;
|
||||||
class SkMatrix;
|
class SkMatrix;
|
||||||
class SkPaint;
|
class SkPaint;
|
||||||
class SkPath;
|
class SkPath;
|
||||||
@ -55,10 +55,6 @@ public:
|
|||||||
void pushPath(const SkPath&, const char tableKey[] = NULL);
|
void pushPath(const SkPath&, const char tableKey[] = NULL);
|
||||||
void pushCanvas(SkCanvas*, const char tableKey[] = NULL);
|
void pushCanvas(SkCanvas*, const char tableKey[] = NULL);
|
||||||
void pushClipStack(const SkClipStack&, const char tableKey[] = NULL);
|
void pushClipStack(const SkClipStack&, const char tableKey[] = NULL);
|
||||||
void pushClipStackElement(const SkClipStack::Element& element, const char tableKey[] = NULL);
|
|
||||||
|
|
||||||
// This SkCanvas lua methods is declared here to benefit from SkLua's friendship with SkCanvas.
|
|
||||||
static int lcanvas_getReducedClipStack(lua_State* L);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
lua_State* fL;
|
lua_State* fL;
|
||||||
|
@ -583,17 +583,7 @@ void SkCanvas::flush() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SkISize SkCanvas::getTopLayerSize() const {
|
SkISize SkCanvas::getDeviceSize() const {
|
||||||
SkBaseDevice* d = this->getTopDevice();
|
|
||||||
return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SkIPoint SkCanvas::getTopLayerOrigin() const {
|
|
||||||
SkBaseDevice* d = this->getTopDevice();
|
|
||||||
return d ? d->getOrigin() : SkIPoint::Make(0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SkISize SkCanvas::getBaseLayerSize() const {
|
|
||||||
SkBaseDevice* d = this->getDevice();
|
SkBaseDevice* d = this->getDevice();
|
||||||
return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
|
return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
|
||||||
}
|
}
|
||||||
|
@ -198,11 +198,11 @@ public:
|
|||||||
|
|
||||||
Iter() {}
|
Iter() {}
|
||||||
|
|
||||||
Iter(const SkTLList& list, IterStart start = kHead_IterStart) {
|
Iter(const SkTLList& list, IterStart start) {
|
||||||
INHERITED::init(list.fList, start);
|
INHERITED::init(list.fList, start);
|
||||||
}
|
}
|
||||||
|
|
||||||
T* init(const SkTLList& list, IterStart start = kHead_IterStart) {
|
T* init(const SkTLList& list, IterStart start) {
|
||||||
return this->nodeToObj(INHERITED::init(list.fList, start));
|
return this->nodeToObj(INHERITED::init(list.fList, start));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SkLua.h"
|
#include "SkLua.h"
|
||||||
|
|
||||||
#include "GrReducedClip.h"
|
|
||||||
#include "SkCanvas.h"
|
#include "SkCanvas.h"
|
||||||
|
#include "SkClipStack.h"
|
||||||
#include "SkData.h"
|
#include "SkData.h"
|
||||||
#include "SkDocument.h"
|
#include "SkDocument.h"
|
||||||
#include "SkImage.h"
|
#include "SkImage.h"
|
||||||
@ -274,35 +273,29 @@ void SkLua::pushClipStack(const SkClipStack& stack, const char* key) {
|
|||||||
const SkClipStack::Element* element;
|
const SkClipStack::Element* element;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (NULL != (element = iter.next())) {
|
while (NULL != (element = iter.next())) {
|
||||||
this->pushClipStackElement(*element);
|
|
||||||
lua_rawseti(fL, -2, ++i);
|
|
||||||
}
|
|
||||||
CHECK_SETFIELD(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SkLua::pushClipStackElement(const SkClipStack::Element& element, const char* key) {
|
|
||||||
lua_newtable(fL);
|
lua_newtable(fL);
|
||||||
SkClipStack::Element::Type type = element.getType();
|
SkClipStack::Element::Type type = element->getType();
|
||||||
this->pushString(element_type(type), "type");
|
this->pushString(element_type(type), "type");
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SkClipStack::Element::kEmpty_Type:
|
case SkClipStack::Element::kEmpty_Type:
|
||||||
break;
|
break;
|
||||||
case SkClipStack::Element::kRect_Type:
|
case SkClipStack::Element::kRect_Type:
|
||||||
this->pushRect(element.getRect(), "rect");
|
this->pushRect(element->getRect(), "rect");
|
||||||
break;
|
break;
|
||||||
case SkClipStack::Element::kRRect_Type:
|
case SkClipStack::Element::kRRect_Type:
|
||||||
this->pushRRect(element.getRRect(), "rrect");
|
this->pushRRect(element->getRRect(), "rrect");
|
||||||
break;
|
break;
|
||||||
case SkClipStack::Element::kPath_Type:
|
case SkClipStack::Element::kPath_Type:
|
||||||
this->pushPath(element.getPath(), "path");
|
this->pushPath(element->getPath(), "path");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this->pushString(region_op(element.getOp()), "op");
|
this->pushString(region_op(element->getOp()), "op");
|
||||||
this->pushBool(element.isAA(), "aa");
|
this->pushBool(element->isAA(), "aa");
|
||||||
|
lua_rawseti(fL, -2, ++i);
|
||||||
|
}
|
||||||
CHECK_SETFIELD(key);
|
CHECK_SETFIELD(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -451,41 +444,6 @@ static int lcanvas_getClipStack(lua_State* L) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkLua::lcanvas_getReducedClipStack(lua_State* L) {
|
|
||||||
const SkCanvas* canvas = get_ref<SkCanvas>(L, 1);
|
|
||||||
SkISize layerSize = canvas->getTopLayerSize();
|
|
||||||
SkIPoint layerOrigin = canvas->getTopLayerOrigin();
|
|
||||||
SkIRect queryBounds = SkIRect::MakeXYWH(layerOrigin.fX, layerOrigin.fY,
|
|
||||||
layerSize.fWidth, layerSize.fHeight);
|
|
||||||
|
|
||||||
GrReducedClip::ElementList elements;
|
|
||||||
GrReducedClip::InitialState initialState;
|
|
||||||
int32_t genID;
|
|
||||||
SkIRect resultBounds;
|
|
||||||
|
|
||||||
const SkClipStack& stack = *canvas->getClipStack();
|
|
||||||
|
|
||||||
GrReducedClip::ReduceClipStack(stack,
|
|
||||||
queryBounds,
|
|
||||||
&elements,
|
|
||||||
&genID,
|
|
||||||
&initialState,
|
|
||||||
&resultBounds,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
GrReducedClip::ElementList::Iter iter(elements);
|
|
||||||
int i = 0;
|
|
||||||
lua_newtable(L);
|
|
||||||
while(NULL != iter.get()) {
|
|
||||||
SkLua(L).pushClipStackElement(*iter.get());
|
|
||||||
iter.next();
|
|
||||||
lua_rawseti(L, -2, ++i);
|
|
||||||
}
|
|
||||||
// Currently this only returns the element list to lua, not the initial state or result bounds.
|
|
||||||
// It could return these as additional items on the lua stack.
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lcanvas_save(lua_State* L) {
|
static int lcanvas_save(lua_State* L) {
|
||||||
lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->save());
|
lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->save());
|
||||||
return 1;
|
return 1;
|
||||||
@ -521,7 +479,7 @@ static int lcanvas_gc(lua_State* L) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct luaL_Reg gSkCanvas_Methods[] = {
|
static const struct luaL_Reg gSkCanvas_Methods[] = {
|
||||||
{ "drawColor", lcanvas_drawColor },
|
{ "drawColor", lcanvas_drawColor },
|
||||||
{ "drawRect", lcanvas_drawRect },
|
{ "drawRect", lcanvas_drawRect },
|
||||||
{ "drawOval", lcanvas_drawOval },
|
{ "drawOval", lcanvas_drawOval },
|
||||||
@ -532,7 +490,6 @@ const struct luaL_Reg gSkCanvas_Methods[] = {
|
|||||||
{ "getSaveCount", lcanvas_getSaveCount },
|
{ "getSaveCount", lcanvas_getSaveCount },
|
||||||
{ "getTotalMatrix", lcanvas_getTotalMatrix },
|
{ "getTotalMatrix", lcanvas_getTotalMatrix },
|
||||||
{ "getClipStack", lcanvas_getClipStack },
|
{ "getClipStack", lcanvas_getClipStack },
|
||||||
{ "getReducedClipStack", SkLua::lcanvas_getReducedClipStack },
|
|
||||||
{ "save", lcanvas_save },
|
{ "save", lcanvas_save },
|
||||||
{ "restore", lcanvas_restore },
|
{ "restore", lcanvas_restore },
|
||||||
{ "scale", lcanvas_scale },
|
{ "scale", lcanvas_scale },
|
||||||
|
@ -11,8 +11,7 @@ end
|
|||||||
function sk_scrape_accumulate(t)
|
function sk_scrape_accumulate(t)
|
||||||
if (t.verb == "restore") then
|
if (t.verb == "restore") then
|
||||||
restoreCount = restoreCount + 1;
|
restoreCount = restoreCount + 1;
|
||||||
-- io.write("Clip Stack at restore #", restoreCount, ":\n")
|
io.write("Clip Stack at restore #", restoreCount, ":\n")
|
||||||
io.write("Reduced Clip Stack at restore #", restoreCount, ":\n")
|
|
||||||
for i = 1, #clipstack do
|
for i = 1, #clipstack do
|
||||||
local element = clipstack[i];
|
local element = clipstack[i];
|
||||||
io.write("\t", element["op"], ", ", element["type"], ", aa:", tostring(element["aa"]))
|
io.write("\t", element["op"], ", ", element["type"], ", aa:", tostring(element["aa"]))
|
||||||
@ -25,8 +24,7 @@ function sk_scrape_accumulate(t)
|
|||||||
end
|
end
|
||||||
io.write("\n")
|
io.write("\n")
|
||||||
else
|
else
|
||||||
-- clipstack = canvas:getClipStack()
|
clipstack = canvas:getClipStack()
|
||||||
clipstack = canvas:getReducedClipStack()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user