<commit_before>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PPAPI_CPP_IMAGE_DATA_H_
#define PPAPI_CPP_IMAGE_DATA_H_

#include "ppapi/c/ppb_image_data.h"
#include "ppapi/cpp/resource.h"

namespace pp {

class DeviceContext2D;
class Plugin;

class ImageData : public Resource {
 public:
  // Creates an is_null() ImageData object.
  ImageData();

  ImageData(const ImageData& other);

  // Allocates a new ImageData in the browser with the given parameters. The
  // resulting object will be is_null() if the allocation failed.
  ImageData(PP_ImageDataFormat format,
            int width, int height,
            bool init_to_zero);

  virtual ~ImageData();

  ImageData& operator=(const ImageData& other);
  void swap(ImageData& other);

  // Returns the browser's preferred format for images. Using this format
  // guarantees no extra conversions will occur when painting.
  static PP_ImageDataFormat GetNativeImageDataFormat();

  PP_ImageDataFormat format() const { return desc_.format; }

  int32_t width() const { return desc_.width; }
  int32_t height() const { return desc_.height; }

  int32_t stride() const { return desc_.stride; }

  void* data() const { return data_; }

  // Helper function to retrieve the address of the given pixel for 32-bit
  // pixel formats.<commit_msg>Fix int / int32_t mismatch between constructor declaration and definition.<commit_after>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PPAPI_CPP_IMAGE_DATA_H_
#define PPAPI_CPP_IMAGE_DATA_H_

#include "ppapi/c/ppb_image_data.h"
#include "ppapi/cpp/resource.h"

namespace pp {

class DeviceContext2D;
class Plugin;

class ImageData : public Resource {
 public:
  // Creates an is_null() ImageData object.
  ImageData();

  ImageData(const ImageData& other);

  // Allocates a new ImageData in the browser with the given parameters. The
  // resulting object will be is_null() if the allocation failed.
  ImageData(PP_ImageDataFormat format,
            int32_t width, int32_t height,
            bool init_to_zero);

  virtual ~ImageData();

  ImageData& operator=(const ImageData& other);
  void swap(ImageData& other);

  // Returns the browser's preferred format for images. Using this format
  // guarantees no extra conversions will occur when painting.
  static PP_ImageDataFormat GetNativeImageDataFormat();

  PP_ImageDataFormat format() const { return desc_.format; }

  int32_t width() const { return desc_.width; }
  int32_t height() const { return desc_.height; }

  int32_t stride() const { return desc_.stride; }

  void* data() const { return data_; }

  // Helper function to retrieve the address of the given pixel for 32-bit
  // pixel formats.
{'fraction_non_alphanumeric': 0.083704974271012, 'fraction_numerical': 0.010977701543739279, 'mean_word_length': 3.8438538205980066, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7343355', 'n_tokens_mistral': 878, 'n_tokens_neox': 825, 'n_words': 317}