gfx/skia/trunk/include/images/SkMovie.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     2 /*
     3  * Copyright 2008 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef SkMovie_DEFINED
    11 #define SkMovie_DEFINED
    13 #include "SkRefCnt.h"
    14 #include "SkCanvas.h"
    16 class SkStreamRewindable;
    18 class SkMovie : public SkRefCnt {
    19 public:
    20     SK_DECLARE_INST_COUNT(SkMovie)
    22     /** Try to create a movie from the stream. If the stream format is not
    23         supported, return NULL.
    24     */
    25     static SkMovie* DecodeStream(SkStreamRewindable*);
    26     /** Try to create a movie from the specified file path. If the file is not
    27         found, or the format is not supported, return NULL. If a movie is
    28         returned, the stream may be retained by the movie (via ref()) until
    29         the movie is finished with it (by calling unref()).
    30     */
    31     static SkMovie* DecodeFile(const char path[]);
    32     /** Try to create a movie from the specified memory.
    33         If the format is not supported, return NULL. If a movie is returned,
    34         the data will have been read or copied, and so the caller may free
    35         it.
    36     */
    37     static SkMovie* DecodeMemory(const void* data, size_t length);
    39     SkMSec  duration();
    40     int     width();
    41     int     height();
    42     int     isOpaque();
    44     /** Specify the time code (between 0...duration) to sample a bitmap
    45         from the movie. Returns true if this time code generated a different
    46         bitmap/frame from the previous state (i.e. true means you need to
    47         redraw).
    48     */
    49     bool setTime(SkMSec);
    51     // return the right bitmap for the current time code
    52     const SkBitmap& bitmap();
    54 protected:
    55     struct Info {
    56         SkMSec  fDuration;
    57         int     fWidth;
    58         int     fHeight;
    59         bool    fIsOpaque;
    60     };
    62     virtual bool onGetInfo(Info*) = 0;
    63     virtual bool onSetTime(SkMSec) = 0;
    64     virtual bool onGetBitmap(SkBitmap*) = 0;
    66     // visible for subclasses
    67     SkMovie();
    69 private:
    70     Info        fInfo;
    71     SkMSec      fCurrTime;
    72     SkBitmap    fBitmap;
    73     bool        fNeedBitmap;
    75     void ensureInfo();
    77     typedef SkRefCnt INHERITED;
    78 };
    80 #endif

mercurial