Qt changes the context on many conditions. Abandon GrContext
in these cases.
Also call GrContext::resetContext during Qt GL paint callback,
the GL state may be touched by Qt.
Fixes the bug where changing between gpu and msaa would start
erroring in framebuffer binds, if the .skp had many layers.
Review URL: https://codereview.chromium.org/915573002
SkStream is a stateful object, so it does not make sense for it to have
multiple owners. Make SkStream inherit directly from SkNoncopyable.
Update methods which previously called SkStream::ref() (e.g.
SkImageDecoder::buildTileIndex() and SkFrontBufferedStream::Create(),
which required the existing owners to call SkStream::unref()) to take
ownership of their SkStream parameters and delete when done (including
on failure).
Switch all SkAutoTUnref<SkStream>s to SkAutoTDelete<SkStream>s. In some
cases this means heap allocating streams that were previously stack
allocated.
Respect ownership rules of SkTypeface::CreateFromStream() and
SkImageDecoder::buildTileIndex().
Update the comments for exceptional methods which do not affect the
ownership of their SkStream parameters (e.g.
SkPicture::CreateFromStream() and SkTypeface::Deserialize()) to be
explicit about ownership.
Remove test_stream_life, which tested that buildTileIndex() behaved
correctly when SkStream was a ref counted object. The test does not
make sense now that it is not.
In SkPDFStream, remove the SkMemoryStream member. Instead of using it,
create a new SkMemoryStream to pass to fDataStream (which is now an
SkAutoTDelete).
Make other pdf rasterizers behave like SkPDFDocumentToBitmap.
SkPDFDocumentToBitmap delete the SkStream, so do the same in the
following pdf rasterizers:
SkPopplerRasterizePDF
SkNativeRasterizePDF
SkNoRasterizePDF
Requires a change to Android, which currently treats SkStreams as ref
counted objects.
Review URL: https://codereview.chromium.org/849103004
The SkDebugCanvas can be (or is currently) being used to draw to multiple
different canvases. If this use-case is intended, then storing draw
-related state in the canvas causes bugs.
Remove incremental draw from SkDebugCanvas. It can only optimize the
case where draw command index is advanced, no other changes are done
and no visualization is used. This case is not that critical, as it
happens only once per new frame at most. It causes bugs, because
one SkDebugCanvas is used to draw to multiple canvases.
Leave the draw to canvas in same state as it was passed in.
This fixes the debugger bugs where:
* Old, stale image would stay on the raster canvas when a new image is
loaded. Also happened with resizes.
* Proper image for overdraw filter would be visible only for the first
frame
Review URL: https://codereview.chromium.org/844493003
Rasterize the picture only when it changes, not every time
raster widget paints itself.
Removes include SkForceLinking.h while organizing the SkDebuggerGUI.cpp
includes.
This is part of the work trying to remove bugs that come from
SkDebugCanvas stateful draw. Part of the state comes from some
optimization that this tries to reproduce in a different way.
Review URL: https://codereview.chromium.org/839743003
Make all fields of inspector view (details tab, clipstack tab, geometry
view) update the correct info when user selects a draw command. Also
update the info regardless if the painting is paused or not.
Current clip and matrix will not update consistently even after this
patch, as they depend on stateful debug canvas draw (may be fixed
later).
Review URL: https://codereview.chromium.org/835903002
The SkDebugCanvas can be (or is currently) being used to draw to multiple
different canvases. If this use-case is intended, then storing draw
-related state in the canvas causes bugs.
Remove draw window size state form SkDebugCanvas. Instead, use the canvas
base layer size as the window size to clip to. This is consistent with
the current use in debugger.
This is part of work trying to remove bugs in debugger that result from
replaying one SkDrawCanvas to two different canvases. Currently the
SkDrawCanvas stores state that can only be valid if it is used for one
canvas.
Review URL: https://codereview.chromium.org/835113002
Update the picture view in the debugger when the first command is
selected. DebugCanvas::drawTo(index) draws up to and including the index.
Review URL: https://codereview.chromium.org/837483002
Use the GUI widget states instead of instance variables
reflecting the widget state.
Fixes the case where pause state would be left on when
switching files, but the image would change to the last
frame of newly loaded image.
Review URL: https://codereview.chromium.org/810033004
Move Skia initialization out of the GUI widget class to the
main function.
Before, Skia may have been already called before the SkGraphics::Init
was run.
Review URL: https://codereview.chromium.org/822583003
Make inspector widget a bit smaller by letting the Qt widget system
layout the widgets.
Let the inspector widget calculate its own smallest size. Use stretch
factor of 0 for inspector, 1 for picture canvas.
Group the matrix and clip widgets in groups. Put the text edits in a grid
layout instead of a handwritted column layout containing row layouts.
This commit is part of work that tries to make the debugger window to be
a bit more resizeable, so that it would fit 1900x1200 screen.
Review URL: https://codereview.chromium.org/830743002
Make draw command image widget resize. The widget was not resizing,
effectively preventing the window from being resized smaller.
Make the rasterized draw command image be proportional to the widget
size. The draw rasterization canvas is still an equilateral rectangle
with dimensions of the smaller side of the widget.
Makes the widget re-rasterize the image only when the draw command
changes, not for each widget paint.
Renames the widget from "image widget" to "draw command geometry
widget".
Makes the background of the image black, similar to the raster widget
background.
Adds a tooltip saying "Command geometry" for the widget, so that user might
understand what the contents should be.
This commit is part of work that tries to make the debugger window to be
a bit more resizeable, so that it would fit 1900x1200 screen.
Review URL: https://codereview.chromium.org/787143004
The settings widget was laid out by hand, eg. the widths of most
elements were hardcoded. This prevented it from being laid out by the Qt
widget system. This in turn prevents the widget from shrinking to its
optimal size. This in turn causes cascading effect where the geometry of
many of the UI widgets has to be hard-coded. This in turn prevents
proper resizing of the UI.
Make Qt layout the settings widget by following changes:
a) Group settings in QGroupBox groups instead of hand-written
layouts and labels hardcoded in certain places.
b) Remove "Expanding" size policy from settings widget. The widget
calculates its own size based on the widgets inside. Thus "Preferred"
is the correct policy to use, as expanding the widget will not
bring any new content visible.
c) Remove maximum width 250 from Settings widget
d) Make "canvas settings and image layout", eg. the horizontal layout
holding the settings widget divide the space between the picture and
settings like so: settings uses up only as much as it needs (stretch
factor 0), while picture uses up everything else (stretch factor 1).
In order to do a) reasonably, reorganize the UI and the code a bit:
a1) Rename settings group "visual filter" to "Visualizations".
a2) Make "visual filter: on/off" combo box a checkbox in
"Visualizations".
a3) Move "Mega viz" setting checkbox from "raster" (or "render targets")
section to "Visualizations"
a4) Move "PathOps" setting checkbox from "raster" to "Visualizations"
a5) Make Raster and GL checkboxes use QGroupBox checkbox feature
a6) Move "current command", "command hitbox" and "zoom level" from
"Settings" widget to part of "Inspector" concept. These pieces of
information are now visualized as their own box in the right-hand
bar, below settings.
a7) Do not expose settings user selects through the UI widgets
state that record the user interacts with. Instead, expose it as state
of the "settings widget". Thus settings widget provides "raster settings
changed" signal, which the client hook to and then query the state
through the object API.
This makes the full window a bit shorter.
This commit is part of work that tries to make the
debugger window to be a bit more resizeable, so that it would fit
1900x1200 screen.
Review URL: https://codereview.chromium.org/829933002
Pass command strings and offset arrays as out parameters instead of
returning new arrays from the functions.
This simplifies debugger leak investigations, as the app leaks less by
design.
Review URL: https://codereview.chromium.org/821663003
Make debugger raster window background black. This helps to understand
where the picture boundaries are. It is probably more common for pictures to
have non-black background vs non-white background.
This makes raster window similar to opengl window.
Review URL: https://codereview.chromium.org/816363002
- move field declarations together and pack them a little tighter
- get rid of fData
- remove dead code in debugger, including unused SkPicturePlayback subclass
There are now no more long-lived SkPictureData! (Really, there never were,
but now we don't pretend to support them.)
BUG=skia:
No API changes.
TBR=reed@google.com
Review URL: https://codereview.chromium.org/725143002
QApplication forces the process to use the C locale system on
"Unix/Linux" according to the docs.
The float numbers in GL shaders will be printed with printf. These will
be formatted with comma in certain locales, like LC_NUMERIC=fi_FI.UTF-8.
Force the NC_NUMERIC=C before running the QApplication.
Review URL: https://codereview.chromium.org/724753002
This splits the playback functionality out of SkPictureData. The old SkPictureData::draw method is pulled out along
with its supporting functions as verbatim as possible. Some follow on CLs will be required to:
re-enable profiling in the debugger (and remove the vestiges of SkTimedPicture)
re-enable display of command offsets in the picture (this should probably wait until we've switched to SkRecord though)
Clean up CachedOperationList (maybe fuse with SkPicture::OperationList)
Split SkPicturePlayback into a base class and two derived classes
Implement parallel version of GatherGPUInfo for SkRecord
Landing this is blocked on removing Android's use of the abortPlayback entry point.
R=mtklein@google.com, reed@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/377623002
I've tagged all the functions in SkPicture.cpp is // fRecord TODO or // fRecord
OK, depending on whether or not they're totally broken when used from an
SkRecord-based picture. Obviously next steps are to eliminate all the TODOs,
then clean up the notes.
I converted SkPicture over to smart pointers too. It's particularly helpful
that the smart pointers initialize to NULL by default.
For now I've got all the SkRecord-based code jammed in at the bottom of the file. I figure it'll help me keep things straight for a bit, then we can rearrange later.
BUG=skia:
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/333823007
This CL begins the process of making SkPicturePlayback & SkPictureRecord independent of SkPicture. It just moves the PathHeap into SkPicture to get a feel for where all this is going to lead.
Some items of note:
SkTimedPicture (debugger/QT) should wind up being just an SkPicturePlayback-derived object.
All the flattening & unflattening should migrate out of SkPicturePlayback and into SkPicture.
SkPicture::initForPlayback should eventually become something just SkPictureRecorder::endRecording calls.
SkPicture is passed into SkPicturePlayback's & SkPictureRecord's constructors. SkPicturePlayback only
holds onto a "const SkPicture*". The SkPicturePlayback:: CreateFromStream & CreateFromBuffer methods pass a non-const
SkPicture* down the call stack.
BUG=skia:2315
R=reed@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/249453002
git-svn-id: http://skia.googlecode.com/svn/trunk@14341 2bbb7eff-a529-9590-31e7-b0007b416f81
Avoid black flashes when resizing debugger window using MSAA. Clear the
stencil buffer always after resize. Also reset the GrContext state
when Qt calls resizeGL -- we do not know what GL state Qt changes.
Remove setting of white background to SkGLWidget, it is not
effective. QGLWidget does not respect the stylesheet.
Also move the initial stencil clearing before GrContext is created
in order to preserve GrContext state consistent with actual GL
state.
R=robertphillips@google.com
Author: kkinnunen@nvidia.com
Review URL: https://codereview.chromium.org/192433003
git-svn-id: http://skia.googlecode.com/svn/trunk@13721 2bbb7eff-a529-9590-31e7-b0007b416f81
*** SKP format breaking change ***
Adding a couple of culling primitives: pushCull(SkRect) & popCull().
These are currently only plumbed for SKP playback quickreject.
At record time, we perform a couple of optimizations to trim down the
number of redundant culls:
* collapse empty pushCull/popCull pairs
* skip pushCull/popCull pairs nested within an identical cull rect
Things still missing/to consider:
* use an inlineable, simplified quickreject (Mike's old prototype)
* debugger visualization for cull boxes
* BBH integration: the initial prototype had some minimal BBH support,
but since the optimizations required expensive rewinds and culling
is expected to be a BBH alternative, it got dropped.
R=bsalomon@google.com, reed@google.com, robertphillips@google.com, caryclark@google.com, tomhudson@google.com, iancottrell@google.com
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/138013009
git-svn-id: http://skia.googlecode.com/svn/trunk@13611 2bbb7eff-a529-9590-31e7-b0007b416f81
Replace the current constructor for creating an
SkPicturePlayback to a factory. In the factory,
check for incorrect data that would result in an invalid
playback. If the playback is invalid, return NULL, and
return NULL from SkPicture's factory as well.
Update SkTimedPicture(Playback) as well.
BUG=skia:1672
R=caryclark@google.com
Review URL: https://codereview.chromium.org/24826002
git-svn-id: http://skia.googlecode.com/svn/trunk@11554 2bbb7eff-a529-9590-31e7-b0007b416f81
Internally the settings and inspector in the debugger are separate, but the
inspector button toggles both of them. This is unfortunate, because both of
these have large minimum vertical sizes. This means that those with vertical
resolutions less than ~1024 cannot see the the details tab.
This change separates the settings and inspector toggles into two so that
the interface is usable on screens of smaller size.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/18279002
git-svn-id: http://skia.googlecode.com/svn/trunk@9835 2bbb7eff-a529-9590-31e7-b0007b416f81
SkPicture:
Remove the constructors which take an SkStream as an argument. Rather
than having to check a variable for success, the factory will return
NULL on failure.
Add a protected function for determining if an SkStream is an SKP
to share code with SkTimedPicture.
In the factory, check for a NULL SkStream.
Use a default decoder (from BUG:
https://code.google.com/p/skia/issues/detail?id=1325)
SkDebuggerGUI:
Call SkPicture::CreateFromStream when necessary.
Write a factory for creating SkTimedPictures and use it.
Use the factory throughout tools.
Add include/lazy to utils and effects gyp include_dirs so SkPicture.h
can reference SkImageDecoder.h which references SkBitmapFactory.h (in
include/lazy).
Changes code Chromium uses, so this will require a temporary Skia
and then a change to Chromium to use the new Skia code.
TODO: Create a decoder that does nothing to be used by pinspect,
lua pictures, etc, and allow it to not assert in SkOrderedReadBuffer.
R=reed@google.com
Review URL: https://codereview.chromium.org/17113004
git-svn-id: http://skia.googlecode.com/svn/trunk@9822 2bbb7eff-a529-9590-31e7-b0007b416f81
SkDebugCanvas & friends are useful beyond the Qt debugger app - Chromium's picture inspector (in development) is at the point where it could take advantage of it.
This patch moves SkDrawCommand, SkDebugCanvas & SkObjectParser from trunk/debugger to trunk/src/utils (since several tools already use these, this seems appropriate), and makes SkDrawCommand & SkDebugCanvas' symbols visible externally (SK_API).
R=reed@google.com
Review URL: https://codereview.chromium.org/16638014
git-svn-id: http://skia.googlecode.com/svn/trunk@9598 2bbb7eff-a529-9590-31e7-b0007b416f81
SkImage calls functions on SkImageDecoder and SkImageEncoder. This
is desired behavior, and it is also desired to include SkImage as
a part of core. In order to keep core from depending on images,
update SkImageDecoder_empty.cpp to implement all of SkImageDecoder
and SkImageEncoder. This file will be built by chrome (in
https://codereview.chromium.org/15960015).
Move force_linking from SkImageDecoder.cpp to its own file. It must
be called to force linking with the image decoders if desired. Call
the function in tools that need it:
sk_image
render_pictures
render_pdfs
sk_hello
filter
bench_pictures
debugger
SkImageDecoder:
Derive from SkNoncopyable, instead of duplicating its
hiding of constructors.
skhello:
Return rather than trying to write a null SkData to the stream.
Revert "Hamfistedly removed core dependence on images"
(commit 0f05f682a90bc125323677abf3476e1027d174f5) and
"Move SkImage::encode to SkImage_Codec.cpp."
(commit 83e47a954d0bf65439f3d9c0c93213063dd70da3.)
These two commits were temporary fixes that this change
cleans up.
SkSnapshot.cpp:
Check for a NULL encoder returned by SkImageEncoder::Create.
BUG=https://code.google.com/p/skia/issues/detail?id=1275R=djsollen@google.com, robertphillips@google.com
Review URL: https://codereview.chromium.org/15806010
git-svn-id: http://skia.googlecode.com/svn/trunk@9364 2bbb7eff-a529-9590-31e7-b0007b416f81
Previously, each tool that wanted to use image decoders
but did not specifically reference them had to create a
dummy function that references them in order to ensure
they are not stripped by the linker.
Instead of making each tool reference each image decoder,
do it once in SkImageDecoder.cpp. Now each tool will have
image decoders linked in, assuming it includes the images
project.
This fixes a bug where SKPs with encoded data could not
be read by bench_ or render_pictures.
R=djsollen@google.com, robertphillips@google.com
Review URL: https://codereview.chromium.org/14678003
git-svn-id: http://skia.googlecode.com/svn/trunk@8941 2bbb7eff-a529-9590-31e7-b0007b416f81