gfx/skia/trunk/src/text/SkTextLayout.cpp

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 2011 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
     8 #include "SkTextLayout.h"
    10 SkTextStyle::SkTextStyle() {
    11     fPaint.setAntiAlias(true);
    12 }
    14 SkTextStyle::SkTextStyle(const SkTextStyle& src) : fPaint(src.fPaint) {}
    16 SkTextStyle::SkTextStyle(const SkPaint& paint) : fPaint(paint) {}
    18 SkTextStyle::~SkTextStyle() {}
    20 ///////////////////////////////////////////////////////////////////////////////
    22 SkTextLayout::SkTextLayout() {
    23     fBounds.setEmpty();
    24     fDefaultStyle = new SkTextStyle;
    25 }
    27 SkTextLayout::~SkTextLayout() {
    28     fDefaultStyle->unref();
    29     fLines.deleteAll();
    30 }
    32 void SkTextLayout::setText(const char text[], size_t length) {
    33     fText.setCount(length);
    34     memcpy(fText.begin(), text, length);
    35 }
    37 void SkTextLayout::setBounds(const SkRect& bounds) {
    38     fBounds = bounds;
    39     // if width changed, inval cache
    40 }
    42 SkTextStyle* SkTextLayout::setDefaultStyle(SkTextStyle* style) {
    43     SkRefCnt_SafeAssign(fDefaultStyle, style);
    44     return style;
    45 }
    47 ///////////////////////////////////////////////////////////////////////////////
    49 struct SkTextLayout::GlyphRun {
    50     GlyphRun();
    51     ~GlyphRun();
    53     SkPoint*    fLocs;
    54     uint16_t*   fGlyphIDs;
    55     int         fCount;
    56 };
    58 SkTextLayout::GlyphRun::GlyphRun() : fLocs(NULL), fGlyphIDs(NULL), fCount(0) {}
    60 SkTextLayout::GlyphRun::~GlyphRun() {
    61     delete[] fLocs;
    62     delete[] fGlyphIDs;
    63 }
    65 struct SkTextLayout::Line {
    66     Line() {}
    67     ~Line();
    69     SkScalar                fBaselineY;
    70     SkTDArray<GlyphRun*>    fRuns;
    71 };
    73 SkTextLayout::Line::~Line() {
    74     fRuns.deleteAll();
    75 }
    77 void SkTextLayout::draw(SkCanvas* canvas) {
    78 }

mercurial