aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-11-22 13:23:35 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-22 18:59:44 +0000
commit4f99e58252175f01c0b9ca1a5e2fc7acec6acec3 (patch)
tree64458810ed2962bbdcb470a4f199feade2be2b03 /include
parentd923a71a113d97dc87b4424c25d5b5019331db24 (diff)
Remove a huge pile of views code
All of this is dead when not using the old SkWindow framework. TBR=reed@google.com Bug: skia: Change-Id: I0f6ab18987a98469bfd367d5bc10967300dfd3ca Reviewed-on: https://skia-review.googlesource.com/75384 Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/views/SkApplication.h30
-rw-r--r--include/views/SkEvent.h144
-rw-r--r--include/views/SkEventSink.h47
-rw-r--r--include/views/SkOSMenu.h182
-rw-r--r--include/views/SkOSWindow_Mac.h63
-rw-r--r--include/views/SkOSWindow_Unix.h88
-rw-r--r--include/views/SkOSWindow_Win.h137
-rw-r--r--include/views/SkOSWindow_iOS.h50
-rw-r--r--include/views/SkView.h60
-rw-r--r--include/views/SkWindow.h137
10 files changed, 3 insertions, 935 deletions
diff --git a/include/views/SkApplication.h b/include/views/SkApplication.h
deleted file mode 100644
index 8f63539a30..0000000000
--- a/include/views/SkApplication.h
+++ /dev/null
@@ -1,30 +0,0 @@
-
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef SkApplication_DEFINED
-#define SkApplication_DEFINED
-
-class SkOSWindow;
-
-extern SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv);
-extern void application_init();
-extern void application_term();
-
-#ifdef SK_BUILD_FOR_IOS
-enum IOS_launch_type {
- kError_iOSLaunchType = -1,
- kTool_iOSLaunchType = 0,
- kApplication__iOSLaunchType = 1
-};
-
-extern IOS_launch_type set_cmd_line_args(int argc, char *argv[],
- const char* resourceDir);
-#endif
-
-#endif // SkApplication_DEFINED
diff --git a/include/views/SkEvent.h b/include/views/SkEvent.h
index 091b7080a2..0efc19a6ea 100644
--- a/include/views/SkEvent.h
+++ b/include/views/SkEvent.h
@@ -38,8 +38,8 @@ public:
typedef bool (*Proc)(const SkEvent& evt);
SkEvent();
- explicit SkEvent(const SkString& type, SkEventSinkID = 0);
- explicit SkEvent(const char type[], SkEventSinkID = 0);
+ explicit SkEvent(const SkString& type);
+ explicit SkEvent(const char type[]);
SkEvent(const SkEvent& src);
~SkEvent();
@@ -63,52 +63,6 @@ public:
void setType(const char type[], size_t len = 0);
/**
- * Return the target ID, or 0 if there is none.
- *
- * When an event is dispatched from the event queue, it is either sent to
- * the eventsink matching the targetID (if not 0), or the target proc is
- * called (if not NULL).
- */
- SkEventSinkID getTargetID() const { return fTargetID; }
-
- /**
- * Set the target ID for this event. 0 means none. Calling this will
- * automatically clear the targetProc to null.
- *
- * When an event is dispatched from the event queue, it is either sent to
- * the eventsink matching the targetID (if not 0), or the target proc is
- * called (if not NULL).
- */
- SkEvent* setTargetID(SkEventSinkID targetID) {
- fTargetProc = nullptr;
- fTargetID = targetID;
- return this;
- }
-
- /**
- * Return the target proc, or NULL if it has none.
- *
- * When an event is dispatched from the event queue, it is either sent to
- * the eventsink matching the targetID (if not 0), or the target proc is
- * called (if not NULL).
- */
- Proc getTargetProc() const { return fTargetProc; }
-
- /**
- * Set the target ID for this event. NULL means none. Calling this will
- * automatically clear the targetID to 0.
- *
- * When an event is dispatched from the event queue, it is either sent to
- * the eventsink matching the targetID (if not 0), or the target proc is
- * called (if not NULL).
- */
- SkEvent* setTargetProc(Proc proc) {
- fTargetID = 0;
- fTargetProc = proc;
- return this;
- }
-
- /**
* Return the event's unnamed 32bit field. Default value is 0
*/
uint32_t getFast32() const { return f32; }
@@ -196,108 +150,16 @@ public:
///////////////////////////////////////////////////////////////////////////
- /**
- * Post to the event queue using the event's targetID or target-proc.
- *
- * The event must be dynamically allocated, as ownership is transferred to
- * the event queue. It cannot be allocated on the stack or in a global.
- */
- void post() {
- return this->postDelay(0);
- }
-
- /**
- * Post to the event queue using the event's targetID or target-proc and
- * the specifed millisecond delay.
- *
- * The event must be dynamically allocated, as ownership is transferred to
- * the event queue. It cannot be allocated on the stack or in a global.
- */
- void postDelay(SkMSec delay);
-
- /**
- * Post to the event queue using the event's targetID or target-proc.
- * The event will be delivered no sooner than the specified millisecond
- * time, as measured by GetMSecsSinceStartup().
- *
- * The event must be dynamically allocated, as ownership is transferred to
- * the event queue. It cannot be allocated on the stack or in a global.
- */
- void postTime(SkMSec time);
-
- /**
- * Returns ~zero the first time it's called, then returns the number of
- * milliseconds since the first call. Behavior is undefined if the program
- * runs more than ~25 days.
- */
- static SkMSec GetMSecsSinceStartup();
-
- ///////////////////////////////////////////////
- /** Porting layer must call these functions **/
- ///////////////////////////////////////////////
-
- /** Global initialization function for the SkEvent system. Should be called exactly
- once before any other event method is called, and should be called after the
- call to SkGraphics::Init().
- */
- static void Init();
- /** Global cleanup function for the SkEvent system. Should be called exactly once after
- all event methods have been called.
- */
- static void Term();
-
- /** Call this to process one event from the queue. If it returns true, there are more events
- to process.
- */
- static bool ProcessEvent();
- /** Call this whenever the requested timer has expired (requested by a call to SetQueueTimer).
- It will post any delayed events whose time as "expired" onto the event queue.
- It may also call SignalQueueTimer() and SignalNonEmptyQueue().
- */
- static void ServiceQueueTimer();
-
- /** Return the number of queued events. note that this value may be obsolete
- upon return, since another thread may have called ProcessEvent() or
- Post() after the count was made.
- */
- static int CountEventsOnQueue();
-
- ////////////////////////////////////////////////////
- /** Porting layer must implement these functions **/
- ////////////////////////////////////////////////////
-
- /** Called whenever an SkEvent is posted to an empty queue, so that the OS
- can be told to later call Dequeue().
- */
- static void SignalNonEmptyQueue();
- /** Called whenever the delay until the next delayed event changes. If zero is
- passed, then there are no more queued delay events.
- */
- static void SignalQueueTimer(SkMSec delay);
-
-#if defined(SK_BUILD_FOR_WIN)
- static bool WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
-#endif
-
private:
SkMetaData fMeta;
mutable char* fType; // may be characters with low bit set to know that it is not a pointer
uint32_t f32;
- // 'there can be only one' (non-zero) between target-id and target-proc
- SkEventSinkID fTargetID;
- Proc fTargetProc;
-
// these are for our implementation of the event queue
SkMSec fTime;
SkEvent* fNextEvent; // either in the delay or normal event queue
- void initialize(const char* type, size_t typeLen, SkEventSinkID);
-
- static bool Enqueue(SkEvent* evt);
- static SkMSec EnqueueTime(SkEvent* evt, SkMSec time);
- static SkEvent* Dequeue();
- static bool QHasEvents();
+ void initialize(const char* type, size_t typeLen);
};
#endif
diff --git a/include/views/SkEventSink.h b/include/views/SkEventSink.h
index bf974f6e5c..076ddb316d 100644
--- a/include/views/SkEventSink.h
+++ b/include/views/SkEventSink.h
@@ -13,8 +13,6 @@
#include "SkRefCnt.h"
#include "SkEvent.h"
-struct SkTagList;
-
/** \class SkEventSink
SkEventSink is the base class for all objects that receive SkEvents.
@@ -44,46 +42,6 @@ public:
bool doQuery(SkEvent* query);
/**
- * Add sinkID to the list of listeners, to receive events from calls to sendToListeners()
- * and postToListeners(). If sinkID already exists in the listener list, no change is made.
- */
- void addListenerID(SkEventSinkID sinkID);
-
- /**
- * Copy listeners from one event sink to another, typically from parent to child.
- * @param from the event sink to copy the listeners from
- */
- void copyListeners(const SkEventSink& from);
-
- /**
- * Remove sinkID from the list of listeners. If sinkID does not appear in the list,
- * no change is made.
- */
- void removeListenerID(SkEventSinkID);
-
- /**
- * Returns true if there are 1 or more listeners attached to this eventsink
- */
- bool hasListeners() const;
-
- /**
- * Posts a copy of evt to each of the eventsinks in the lisener list.
- * This ignores the targetID and target proc in evt.
- */
- void postToListeners(const SkEvent& evt, SkMSec delay = 0);
-
- enum EventResult {
- kHandled_EventResult, //!< the eventsink returned true from its doEvent method
- kNotHandled_EventResult, //!< the eventsink returned false from its doEvent method
- kSinkNotFound_EventResult //!< no matching eventsink was found for the event's getSink().
- };
-
- /**
- * DoEvent handles dispatching the event to its target ID or proc.
- */
- static EventResult DoEvent(const SkEvent&);
-
- /**
* Returns the matching eventsink, or null if not found
*/
static SkEventSink* FindSink(SkEventSinkID);
@@ -95,13 +53,8 @@ protected:
virtual bool onEvent(const SkEvent&);
virtual bool onQuery(SkEvent*);
- SkTagList* findTagList(U8CPU tag) const;
- void addTagList(SkTagList*);
- void removeTagList(U8CPU tag);
-
private:
SkEventSinkID fID;
- SkTagList* fTagHead;
// for our private link-list
SkEventSink* fNextSink;
diff --git a/include/views/SkOSMenu.h b/include/views/SkOSMenu.h
deleted file mode 100644
index 913b915387..0000000000
--- a/include/views/SkOSMenu.h
+++ /dev/null
@@ -1,182 +0,0 @@
-
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef SkOSMenu_DEFINED
-#define SkOSMenu_DEFINED
-
-#include "../private/SkTDArray.h"
-#include "SkEvent.h"
-
-class SkOSMenu {
-public:
- explicit SkOSMenu(const char title[] = "");
- ~SkOSMenu();
-
- /**
- * Each of these (except action) has an associated value, which is stored in
- * the event payload for the item.
- * Each type has a specific type for its value...
- * Action : none
- * List : int (selected index)
- * Segmented : int (selected index)
- * Slider : float
- * Switch : bool
- * TextField : string
- * TriState : TriState
- * Custom : custom object/value
- */
- enum Type {
- kAction_Type,
- kList_Type,
- kSlider_Type,
- kSwitch_Type,
- kTriState_Type,
- kTextField_Type,
- kCustom_Type
- };
-
- enum TriState {
- kMixedState = -1,
- kOffState = 0,
- kOnState = 1
- };
-
- class Item {
- public:
- /**
- * Auto increments a global to generate an unique ID for each new item
- * Note: Thread safe
- */
- Item(const char label[], SkOSMenu::Type type, const char slotName[],
- SkEvent* evt);
- ~Item() { delete fEvent; }
-
- SkEvent* getEvent() const { return fEvent; }
- int getID() const { return fID; }
- const char* getLabel() const { return fLabel.c_str(); }
- const char* getSlotName() const { return fSlotName.c_str(); }
- Type getType() const { return fType; }
- void setKeyEquivalent(SkUnichar key) { fKey = key; }
- SkUnichar getKeyEquivalent() const { return fKey; }
-
- /**
- * Helper functions for predefined types
- */
- void setBool(bool value) const; //For Switch
- void setScalar(SkScalar value) const; //For Slider
- void setInt(int value) const; //For List
- void setTriState(TriState value) const; //For Tristate
- void setString(const char value[]) const; //For TextField
-
- /**
- * Post event associated with the menu item to target, any changes to
- * the associated event must be made prior to calling this method
- */
- void postEvent() const { (new SkEvent(*(fEvent)))->post(); }
-
- private:
- int fID;
- SkEvent* fEvent;
- SkString fLabel;
- SkString fSlotName;
- Type fType;
- SkUnichar fKey;
- };
-
- void reset();
- const char* getTitle() const { return fTitle.c_str(); }
- void setTitle (const char title[]) { fTitle.set(title); }
- int getCount() const { return fItems.count(); }
- const Item* getItemByID(int itemID) const;
- void getItems(const Item* items[]) const;
-
- /**
- * Assign key to the menu item with itemID, will do nothing if there's no
- * item with the id given
- */
- void assignKeyEquivalentToItem(int itemID, SkUnichar key);
- /**
- * Call this in a SkView's onHandleChar to trigger any menu items with the
- * given key equivalent. If such an item is found, the method will return
- * true and its corresponding event will be triggered (default behavior
- * defined for switches(toggling), tristates(cycle), and lists(cycle),
- * for anything else, the event attached is posted without state changes)
- * If no menu item can be matched with the key, false will be returned
- */
- bool handleKeyEquivalent(SkUnichar key);
-
- /**
- * The following functions append new items to the menu and returns their
- * associated unique id, which can be used to by the client to refer to
- * the menu item created and change its state. slotName specifies the string
- * identifier of any state/value to be returned in the item's SkEvent object
- * NOTE: evt must be dynamically allocated
- */
- int appendItem(const char label[], Type type, const char slotName[],
- SkEvent* evt);
-
- /**
- * Create predefined items with the given parameters. To be used with the
- * other helper functions below to retrive/update state information.
- * Note: the helper functions below assume that slotName is UNIQUE for all
- * menu items of the same type since it's used to identify the event
- */
- int appendAction(const char label[], SkEventSinkID target);
- int appendList(const char label[], const char slotName[],
- SkEventSinkID target, int defaultIndex, const char* ...);
- int appendSlider(const char label[], const char slotName[],
- SkEventSinkID target, SkScalar min, SkScalar max,
- SkScalar defaultValue);
- int appendSwitch(const char label[], const char slotName[],
- SkEventSinkID target, bool defaultState = false);
- int appendTriState(const char label[], const char slotName[],
- SkEventSinkID target, TriState defaultState = kOffState);
- int appendTextField(const char label[], const char slotName[],
- SkEventSinkID target, const char placeholder[] = "");
-
-
- /**
- * Helper functions to retrieve information other than the stored value for
- * some predefined types
- */
- static bool FindListItemCount(const SkEvent& evt, int* count);
- /**
- * Ensure that the items array can store n SkStrings where n is the count
- * extracted using FindListItemCount
- */
- static bool FindListItems(const SkEvent& evt, SkString items[]);
- static bool FindSliderMin(const SkEvent& evt, SkScalar* min);
- static bool FindSliderMax(const SkEvent& evt, SkScalar* max);
-
- /**
- * Returns true if an action with the given label is found, false otherwise
- */
- static bool FindAction(const SkEvent& evt, const char label[]);
- /**
- * The following helper functions will return true if evt is generated from
- * a predefined item type and retrieve the corresponding state information.
- * They will return false and leave value unchanged if there's a type
- * mismatch or slotName is incorrect
- */
- static bool FindListIndex(const SkEvent& evt, const char slotName[], int* value);
- static bool FindSliderValue(const SkEvent& evt, const char slotName[], SkScalar* value);
- static bool FindSwitchState(const SkEvent& evt, const char slotName[], bool* value);
- static bool FindTriState(const SkEvent& evt, const char slotName[], TriState* value);
- static bool FindText(const SkEvent& evt, const char slotName[], SkString* value);
-
-private:
- SkString fTitle;
- SkTDArray<Item*> fItems;
-
- // illegal
- SkOSMenu(const SkOSMenu&);
- SkOSMenu& operator=(const SkOSMenu&);
-};
-
-#endif
diff --git a/include/views/SkOSWindow_Mac.h b/include/views/SkOSWindow_Mac.h
deleted file mode 100644
index d331ecaa71..0000000000
--- a/include/views/SkOSWindow_Mac.h
+++ /dev/null
@@ -1,63 +0,0 @@
-
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkOSWindow_MacCocoa_DEFINED
-#define SkOSWindow_MacCocoa_DEFINED
-
-#include "SkWindow.h"
-
-class SkOSWindow : public SkWindow {
-public:
- SkOSWindow(void* hwnd, int w, int h);
- SkOSWindow(void* hwnd);
- ~SkOSWindow();
- void* getHWND() const { return fHWND; }
-
- virtual bool onDispatchClick(int x, int y, Click::State state,
- void* owner, unsigned modi);
- enum SkBackEndTypes {
- kNone_BackEndType,
-#if SK_SUPPORT_GPU
- kNativeGL_BackEndType,
-#endif
-#if SK_ANGLE
- kANGLE_BackEndType,
-#endif // SK_ANGLE
- };
-
- void release();
- bool attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor,
- AttachmentInfo*);
- void present();
-
- bool makeFullscreen();
- void closeWindow();
- void setVsync(bool);
-protected:
- // overrides from SkEventSink
- virtual bool onEvent(const SkEvent& evt);
- // overrides from SkWindow
- virtual void onHandleInval(const SkIRect&);
- // overrides from SkView
- virtual void onAddMenu(const SkOSMenu*);
- virtual void onUpdateMenu(const SkOSMenu*);
- virtual void onSetTitle(const char[]);
-
-private:
- void init(void* hwnd, int w, int h);
-
- void* fHWND;
- bool fInvalEventIsPending;
- void* fNotifier;
-#if SK_SUPPORT_GPU
- void* fGLContext;
-#endif
- typedef SkWindow INHERITED;
-};
-
-#endif
diff --git a/include/views/SkOSWindow_Unix.h b/include/views/SkOSWindow_Unix.h
deleted file mode 100644
index e1961316e4..0000000000
--- a/include/views/SkOSWindow_Unix.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkOSWindow_Unix_DEFINED
-#define SkOSWindow_Unix_DEFINED
-
-#include <GL/glx.h>
-#include <X11/Xlib.h>
-
-#include "SkWindow.h"
-
-class SkEvent;
-
-struct SkUnixWindow {
- Display* fDisplay;
- Window fWin;
- size_t fOSWin;
- GC fGc;
- GLXContext fGLContext;
-};
-
-class SkOSWindow : public SkWindow {
-public:
- SkOSWindow(void*);
- SkOSWindow(void*, int width, int height);
- ~SkOSWindow() override;
-
- void* getHWND() const { return (void*)fUnixWindow.fWin; }
- void* getDisplay() const { return (void*)fUnixWindow.fDisplay; }
- void* getUnixWindow() const { return (void*)&fUnixWindow; }
- void loop();
-
- enum SkBackEndTypes {
- kNone_BackEndType,
- kNativeGL_BackEndType,
-#if SK_ANGLE
- kANGLE_BackEndType,
-#endif // SK_ANGLE
- };
-
- bool attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor, AttachmentInfo*);
- void release();
- void present();
-
- int getMSAASampleCount() const { return fMSAASampleCount; }
-
- //static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
-
- bool makeFullscreen();
- void setVsync(bool);
- void closeWindow();
-
-protected:
- // Overridden from from SkWindow:
- void onSetTitle(const char title[]) override;
-
-private:
- enum NextXEventResult {
- kContinue_NextXEventResult,
- kQuitRequest_NextXEventResult,
- kPaintRequest_NextXEventResult
- };
-
- NextXEventResult nextXEvent();
- void doPaint();
- void mapWindowAndWait();
-
- // Forcefully closes the window. If a graceful shutdown is desired then call the public
- // closeWindow method
- void internalCloseWindow();
- void initWindow(int newMSAASampleCount, AttachmentInfo* info, int w, int h);
- void init(int w, int h);
-
- SkUnixWindow fUnixWindow;
-
- // Needed for GL
- XVisualInfo* fVi;
- // we recreate the underlying xwindow if this changes
- int fMSAASampleCount;
-
- typedef SkWindow INHERITED;
-};
-
-#endif
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
deleted file mode 100644
index 076b4147a0..0000000000
--- a/include/views/SkOSWindow_Win.h
+++ /dev/null
@@ -1,137 +0,0 @@
-
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef SkOSWindow_Win_DEFINED
-#define SkOSWindow_Win_DEFINED
-
-#include "../private/SkTHash.h"
-#include "SkWindow.h"
-#include <functional>
-
-#if SK_ANGLE
-#include "EGL/egl.h"
-#endif
-
-class SkOSWindow : public SkWindow {
-public:
- struct WindowInit {
- const TCHAR* fClass;
- HINSTANCE fInstance;
- };
-
- SkOSWindow(const void* winInit);
- SkOSWindow(const void* winInit, int w, int h);
- virtual ~SkOSWindow();
-
- static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
-
- enum SkBackEndTypes {
- kNone_BackEndType,
-#if SK_SUPPORT_GPU
- kNativeGL_BackEndType,
-#if SK_ANGLE
- kANGLE_BackEndType,
-#endif // SK_ANGLE
-#endif // SK_SUPPORT_GPU
- };
-
- bool attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor, AttachmentInfo*);
- void release();
- void present();
-
- bool wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
- static bool QuitOnDeactivate(HWND hWnd);
-
- enum {
- SK_WM_SkEvent = WM_APP + 1000,
- SK_WM_SkTimerID = 0xFFFF // just need a non-zero value
- };
-
- bool makeFullscreen();
- void setVsync(bool);
- void closeWindow();
-
- static SkOSWindow* GetOSWindowForHWND(void* hwnd) {
- SkOSWindow** win = gHwndToOSWindowMap.find(hwnd);
- if (!win) {
- return NULL;
- }
- return *win;
- }
-
- // Iterates f over all the SkOSWindows and their corresponding HWNDs.
- // The void* argument to f is a HWND.
- static void ForAllWindows(const std::function<void(void*, SkOSWindow**)>& f) {
- gHwndToOSWindowMap.foreach(f);
- }
-
-protected:
- virtual bool quitOnDeactivate() { return true; }
-
- // overrides from SkWindow
- virtual void onHandleInval(const SkIRect&);
- // overrides from SkView
- virtual void onAddMenu(const SkOSMenu*);
-
- virtual void onSetTitle(const char title[]);
-
-private:
- static SkTHashMap<void*, SkOSWindow*> gHwndToOSWindowMap;
-
- WindowInit fWinInit;
- void* fHWND;
-
- void doPaint(void* ctx);
- void init(const void* winInit, int w, int h);
-
-#if SK_SUPPORT_GPU
- void* fHGLRC;
-#if SK_ANGLE
- EGLDisplay fDisplay;
- EGLContext fContext;
- EGLSurface fSurface;
- EGLConfig fConfig;
- sk_sp<const GrGLInterface> fANGLEInterface;
-#endif // SK_ANGLE
-#endif // SK_SUPPORT_GPU
-
- bool fFullscreen;
- struct SavedWindowState {
- bool fZoomed;
- LONG fStyle;
- LONG fExStyle;
- RECT fRect;
- LONG fScreenWidth;
- LONG fScreenHeight;
- LONG fScreenBits;
- void* fHWND;
- } fSavedWindowState;
-
- HMENU fMBar;
-
- SkBackEndTypes fAttached;
-
- void updateSize();
-#if SK_SUPPORT_GPU
- bool attachGL(int msaaSampleCount, bool deepColor, AttachmentInfo* info);
- void detachGL();
- void presentGL();
-
-#if SK_ANGLE
- bool attachANGLE(int msaaSampleCount, AttachmentInfo* info);
- void detachANGLE();
- void presentANGLE();
-#endif // SK_ANGLE
-
-#endif // SK_SUPPORT_GPU
-
- typedef SkWindow INHERITED;
-};
-
-#endif
diff --git a/include/views/SkOSWindow_iOS.h b/include/views/SkOSWindow_iOS.h
deleted file mode 100644
index 3b540cff3f..0000000000
--- a/include/views/SkOSWindow_iOS.h
+++ /dev/null
@@ -1,50 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#ifndef SkOSWindow_iOS_DEFINED
-#define SkOSWindow_iOS_DEFINED
-
-#include "SkWindow.h"
-
-class SkOSWindow : public SkWindow {
-public:
- SkOSWindow(void* hwnd);
- ~SkOSWindow();
- void* getHWND() const { return fHWND; }
-
- enum SkBackEndTypes {
- kNone_BackEndType,
- kNativeGL_BackEndType,
- };
-
- void release();
- bool attach(SkBackEndTypes attachType, int msaaSampleCount, bool deepColor,
- AttachmentInfo*);
- void present();
-
- bool makeFullscreen() { return true; }
- void closeWindow() { /* Not impl yet */ }
- void setVsync(bool) { /* Can't turn off vsync? */ }
-
-protected:
- // overrides from SkEventSink
- virtual bool onEvent(const SkEvent& evt);
- // overrides from SkWindow
- virtual void onHandleInval(const SkIRect&);
- // overrides from SkView
- virtual void onAddMenu(const SkOSMenu*);
- virtual void onUpdateMenu(const SkOSMenu*);
- virtual void onSetTitle(const char[]);
-
-private:
- void* fHWND;
- bool fInvalEventIsPending;
- void* fNotifier;
- typedef SkWindow INHERITED;
-};
-
-#endif
diff --git a/include/views/SkView.h b/include/views/SkView.h
index 43f86f501e..5a61d9e521 100644
--- a/include/views/SkView.h
+++ b/include/views/SkView.h
@@ -250,66 +250,6 @@ public:
SkView* fFirstChild, *fChild;
};
- /** \class Artist
-
- Install a subclass of this in a view (calling setArtist()), and then the
- default implementation of that view's onDraw() will invoke this object
- automatically.
- */
- class Artist : public SkRefCnt {
- public:
-
-
- void draw(SkView*, SkCanvas*);
- void inflate(const SkDOM&, const SkDOMNode*);
- protected:
- virtual void onDraw(SkView*, SkCanvas*) = 0;
- virtual void onInflate(const SkDOM&, const SkDOMNode*);
- private:
- typedef SkRefCnt INHERITED;
- };
- /** Return the artist attached to this view (or null). The artist's reference
- count is not affected.
- */
- Artist* getArtist() const;
- /** Attach the specified artist (or null) to the view, replacing any existing
- artist. If the new artist is not null, its reference count is incremented.
- The artist parameter is returned.
- */
- Artist* setArtist(Artist* artist);
-
- /** \class Layout
-
- Install a subclass of this in a view (calling setLayout()), and then the
- default implementation of that view's onLayoutChildren() will invoke
- this object automatically.
- */
- class Layout : public SkRefCnt {
- public:
-
-
- void layoutChildren(SkView* parent);
- void inflate(const SkDOM&, const SkDOMNode*);
- protected:
- virtual void onLayoutChildren(SkView* parent) = 0;
- virtual void onInflate(const SkDOM&, const SkDOMNode*);
- private:
- typedef SkRefCnt INHERITED;
- };
-
- /** Return the layout attached to this view (or null). The layout's reference
- count is not affected.
- */
- Layout* getLayout() const;
- /** Attach the specified layout (or null) to the view, replacing any existing
- layout. If the new layout is not null, its reference count is incremented.
- The layout parameter is returned.
- */
- Layout* setLayout(Layout*, bool invokeLayoutNow = true);
- /** If a layout is attached to this view, call its layoutChildren() method
- */
- void invokeLayout();
-
/** Call this to initialize this view based on the specified XML node
*/
void inflate(const SkDOM& dom, const SkDOMNode* node);
diff --git a/include/views/SkWindow.h b/include/views/SkWindow.h
deleted file mode 100644
index 8b6c29186b..0000000000
--- a/include/views/SkWindow.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 2006 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkWindow_DEFINED
-#define SkWindow_DEFINED
-
-#include "../private/SkTDArray.h"
-#include "SkView.h"
-#include "SkBitmap.h"
-#include "SkMatrix.h"
-#include "SkRegion.h"
-#include "SkEvent.h"
-#include "SkKey.h"
-#include "SkSurfaceProps.h"
-
-class SkSurface;
-class SkOSMenu;
-
-#if SK_SUPPORT_GPU
-struct GrGLInterface;
-class GrContext;
-class GrRenderTarget;
-#endif
-
-class SkWindow : public SkView {
-public:
- SkWindow();
- virtual ~SkWindow();
-
- struct AttachmentInfo {
- AttachmentInfo()
- : fSampleCount(0)
- , fStencilBits(0)
- , fColorBits(0) {}
-
- int fSampleCount;
- int fStencilBits;
- int fColorBits;
- };
-
- SkSurfaceProps getSurfaceProps() const { return fSurfaceProps; }
- void setSurfaceProps(const SkSurfaceProps& props) {
- fSurfaceProps = props;
- }
-
- SkImageInfo info() const { return fBitmap.info(); }
- const SkBitmap& getBitmap() const { return fBitmap; }
-
- void resize(int width, int height);
- void resize(const SkImageInfo&);
- void setColorType(SkColorType, sk_sp<SkColorSpace>);
-
- bool isDirty() const { return !fDirtyRgn.isEmpty(); }
- bool update(SkIRect* updateArea);
- // does not call through to onHandleInval(), but does force the fDirtyRgn
- // to be wide open. Call before update() to ensure we redraw everything.
- void forceInvalAll();
- // return the bounds of the dirty/inval rgn, or [0,0,0,0] if none
- const SkIRect& getDirtyBounds() const { return fDirtyRgn.getBounds(); }
-
- bool handleClick(int x, int y, Click::State, void* owner, unsigned modi = 0);
- bool handleChar(SkUnichar);
- bool handleKey(SkKey);
- bool handleKeyUp(SkKey);
-
- void addMenu(SkOSMenu*);
- const SkTDArray<SkOSMenu*>* getMenus() { return &fMenus; }
-
- const char* getTitle() const { return fTitle.c_str(); }
- void setTitle(const char title[]);
-
- const SkMatrix& getMatrix() const { return fMatrix; }
- void setMatrix(const SkMatrix&);
- void preConcat(const SkMatrix&);
- void postConcat(const SkMatrix&);
-
- virtual sk_sp<SkSurface> makeSurface();
-
-#if SK_SUPPORT_GPU
- sk_sp<SkSurface> makeGpuBackedSurface(const AttachmentInfo& attachmentInfo,
- const GrGLInterface* , GrContext* grContext);
-#endif
-
-protected:
- virtual bool onEvent(const SkEvent&);
- virtual bool onDispatchClick(int x, int y, Click::State, void* owner, unsigned modi);
- // called if part of our bitmap is invalidated
- virtual void onHandleInval(const SkIRect&);
- virtual bool onHandleChar(SkUnichar);
- virtual bool onHandleKey(SkKey);
- virtual bool onHandleKeyUp(SkKey);
- virtual void onAddMenu(const SkOSMenu*) {}
- virtual void onUpdateMenu(const SkOSMenu*) {}
- virtual void onSetTitle(const char title[]) {}
-
- // overrides from SkView
- virtual bool handleInval(const SkRect*);
- virtual bool onGetFocusView(SkView** focus) const;
- virtual bool onSetFocusView(SkView* focus);
-
-private:
- SkSurfaceProps fSurfaceProps;
- SkBitmap fBitmap;
- SkRegion fDirtyRgn;
-
- SkTDArray<Click*> fClicks; // to track clicks
-
- SkTDArray<SkOSMenu*> fMenus;
-
- SkView* fFocusView;
- bool fWaitingOnInval;
-
- SkString fTitle;
- SkMatrix fMatrix;
-
- typedef SkView INHERITED;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-#if defined(SK_BUILD_FOR_MAC)
- #include "SkOSWindow_Mac.h"
-#elif defined(SK_BUILD_FOR_WIN)
- #include "SkOSWindow_Win.h"
-#elif defined(SK_BUILD_FOR_ANDROID)
- #error Android does not support SkOSWindow and SampleApp. Please use Viewer instead.
-#elif defined(SK_BUILD_FOR_UNIX)
- #include "SkOSWindow_Unix.h"
-#elif defined(SK_BUILD_FOR_IOS)
- #include "SkOSWindow_iOS.h"
-#endif
-
-#endif